Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/assets/javascripts/about.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/about.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the About controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
4 changes: 2 additions & 2 deletions app/assets/stylesheets/general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
}

.main-view-container {
padding-right: 1em;
padding-left: 1em;
padding-right: .25em;
padding-left: .25em;
}

.inline {
Expand Down
6 changes: 5 additions & 1 deletion app/assets/stylesheets/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
}

.version {
font-size: 55%;
font-size: 60%;
}

#verticals-nav {
display: inline-block;

a {
font-size: 16px;
}

ul {
vertical-align: top;
display: inline-block;
Expand Down
142 changes: 136 additions & 6 deletions app/assets/stylesheets/vertical.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ li .snippet {
margin-top: 1em;
}

.tag-badge {

.tag-badge-0 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: white;
background-color: red;
a, a:active, a:hover, a:visited {
color: white;
}
Expand All @@ -97,6 +99,132 @@ li .snippet {
}
}

.tag-badge-1 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: black;
background-color: cyan;
a, a:active, a:hover, a:visited {
color: black;
}

.edit:hover, .delete:hover {
color: #ccc;
}
}

.tag-badge-2 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: white;
background-color: green;
a, a:active, a:hover, a:visited {
color: white;
}

.edit:hover, .delete:hover {
color: #ccc;
}
}
.tag-badge-3 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: white;
background-color: blue;
a, a:active, a:hover, a:visited {
color: white;
}

.edit:hover, .delete:hover {
color: #ccc;
}
}

.tag-badge-4 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: white;
background-color: brown;
a, a:active, a:hover, a:visited {
color: white;
}

.edit:hover, .delete:hover {
color: #ccc;
}
}

.tag-badge-5 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: white;
background-color: black;
a, a:active, a:hover, a:visited {
color: white;
}

.edit:hover, .delete:hover {
color: #ccc;
}
}

.tag-badge-6 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: black;
background-color: skyblue;
a, a:active, a:hover, a:visited {
color: black;
}

.edit:hover, .delete:hover {
color: red;
}
}

.tag-badge-7 {
font-size: 85%;
border-radius: 2em;
background-color: lighten($brand-primary, 0%);
display: inline-block;
padding-left: .5em;
padding-right: .5em;
color: black;
background-color: grey;
a, a:active, a:hover, a:visited {
color: black;
}

.edit:hover, .delete:hover {
color: red;
}
}


span.tag-title, span.summary-title {
font-weight: bold;
}
Expand Down Expand Up @@ -326,6 +454,7 @@ ul.authors, ul.instructors {

.vertical-index .assignment_group.index-entry {
height: 500px;
border: 20px, solid, #0000;
.item-content {
height: 275px;
}
Expand Down Expand Up @@ -362,33 +491,34 @@ ul.authors, ul.instructors {


.analysis-page, .software-page, .dataset-page, .example-page {

background-color: #d3d3d3;
.thumbnail-wrapper.show-view {
margin-top: 20px;
margin-top: 50px;
background-size: cover;
background-position-x: 50%;
background-position-y: center;
border: 5px solid #45b6fe;


height: 175px;
width: 100%;
display: block;
overflow: hidden;

// border-bottom: 1px solid #ccc;

img {
width: 100%;
}
}
}

.assignment-page {
background-color: #d3d3d3;
.thumbnail-wrapper.show-view {
//margin-top: 20px;
margin-bottom: 20px;
background-size: cover;
background-position-x: 50%;
background-position-y: center;
border: 5px solid #45b6fe;


height: 175px;
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/about_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AboutController < ApplicationController
def index
about_path
end
end
31 changes: 27 additions & 4 deletions app/controllers/analyses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ class AnalysesController < ApplicationController
before_action :get_redirect_path

def index
@analyses = Analysis.all.sort_by { |e| e.name }
@analyses = Analysis.where({creator: current_user}).or(Analysis.where({is_draft: false})).sort_by { |e| e.name }
end

def connect_index
@analyses = Analysis.all.sort_by { |e| e.name }
@analyses = Analysis.where({creator: current_user}).or(Analysis.where({is_draft: false})).sort_by { |e| e.name }
if @vertical.class == Analysis
@analyses.delete(@vertical)
end
end

def show
if (@analysis.is_draft and @analysis.creator != current_user)
error = "You are unauthorised to view this assignment."
respond_to do |format|
format.json {render json: {success: false, error: error}}
format.html do
render file: "#{Rails.root}/public/404.html" , status: 404
end
end
end
end

def new
Expand All @@ -30,9 +39,15 @@ def edit

## Creates a new analysis entry.
def create
if params[:button_press] == "Save"
@data[:is_draft] = false
@success_message = "Analysis created successfully!"
else
@data[:is_draft] = true
@success_message = "Analysis saved as draft!"
end
@data[:creator] = current_user
@analysis = Analysis.new(@data)

# ## Make sure we have the required fields.
# if get_with_default(@data, :name, "").empty? or
# get_with_default(@data, :summary, "").empty? or
Expand Down Expand Up @@ -60,9 +75,17 @@ def create
## and deleted altogether if the resource isn't associated with another
## vertical entry.
def update
if params[:button_press] == "Save"
@data[:is_draft] = false
@success_message = "Analysis created successfully!"
else
@data[:is_draft] = true
@success_message = "Analysis saved as draft!"
end

begin
ActiveRecord::Base.transaction do
@analysis.update(@data.permit(:name, :description, :summary, :thumbnail))
@analysis.update(@data.permit(:name, :description, :summary, :thumbnail, :is_draft))
@analysis.save!
@analysis.reindex_associations

Expand Down
Loading