Skip to content

Commit

Permalink
Merge pull request #2771 from isenseDev/stage
Browse files Browse the repository at this point in the history
v9.6.2
  • Loading branch information
doug-salvati authored Dec 1, 2017
2 parents 3f2c6b5 + e54cbbd commit cc5af29
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .ebextensions/deploy.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ files:
group: root
content: |
#!/usr/bin/env bash
wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/rpm/x86_64/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
tar -xvzf LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
cd LibreOffice_5.3.6.1_Linux_x86-64_rpm/RPMS
wget http://download.documentfoundation.org/libreoffice/stable/5.4.3/rpm/x86_64/LibreOffice_5.4.3_Linux_x86-64_rpm.tar.gz
tar -xvzf LibreOffice_5.4.3_Linux_x86-64_rpm.tar.gz
cd LibreOffice_5.4.3.2_Linux_x86-64_rpm/RPMS/
yum install *.rpm
cd /
rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm
rm -r /tmp/LibreOffice_5.4.3_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.4.3.2_Linux_x86-64_rpm
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
Expand Down
26 changes: 13 additions & 13 deletions app/assets/javascripts/projects/show.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,12 @@ IS.onReady "projects/show", ->
# Takes all sessions that are checked, appends its id to the url and
# redirects the user to the view sessions page (Vis page)
$('#vis_button').click (e) ->
unchecked = $(document).find(".dataset .ds_selector input:not(:checked)")
unchecked_list = (get_ds_id u for u in unchecked)
# Viewing a subset of the data sets
if unchecked_list.length > 0 or window.location.href.indexOf('&search') != -1
targets = $(document).find(".dataset .ds_selector input:checked")
ds_list = (get_ds_id t for t in targets)
# Set the value in the hidden form field
$('#visualize_selected>input').attr('value', ds_list)
# POST form
$('#visualize_selected').submit()
# Just show them all the old-fashioned way
else
window.location = $(this).attr("data-href")
targets = $(document).find(".dataset .ds_selector input:checked")
ds_list = (get_ds_id t for t in targets)
# Set the value in the hidden form field
$('#visualize_selected>input').attr('value', ds_list)
# POST form
$('#visualize_selected').submit()

$('#export_button').click (e) ->
$('#export_modal').modal('show')
Expand Down Expand Up @@ -335,6 +328,13 @@ IS.onReady "projects/show", ->
e.preventDefault()
window.print()

###
# Update per_page param when a drop-down option is selected
###
$("select#display_n").change ->
window.location.href = window.location.origin + window.location.pathname +
"?per_page=#{$("#display_n option:selected").val()}"

###
# Tags
###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,15 @@ $ ->
savedConfigs = savedGlobals['globals']
savedAnnotations = savedGlobals['annotations']
$.extend(globals.configs, savedConfigs)
# Load annotations
if savedAnnotations?
globals.annotationSet = new AnnotationSet
for elt in savedAnnotations.list
annotation = $.extend(true, new Annotation, elt)
globals.annotationSet.addToList annotation
# If on mobile, close sidebar
if window.innerWidth <= 600
globals.configs.ctrlsOpen = false

# Restore vis specific configs
for visName in data.allVis
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ body {
}
}

#featured_vis {
padding: 0;

iframe {
border-radius: 10px
}
}


#news {
background: #bcd66f;
background: -moz-linear-gradient(top, #bcd66f 0%, #60c600 40%, #1f9100 100%);
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/projects.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@
#create_data_set {
text-align: center;
}

#display_n
{
width: 115%;
padding: 0 10 0 0;
}
16 changes: 12 additions & 4 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ def show

@cloned_project = Project.select(:id, :user_id, :title).where(id: @project.cloned_from).first
@liked_by_cur_user = Like.find_by_user_id_and_project_id(current_user, @project.id)
@data_sets = @project.data_sets.includes(:user).select('id', 'title', 'user_id', 'key', 'created_at', 'contributor_name').search(params[:search])
@all_data_sets = @project.data_sets.includes(:user).select('id', 'title', 'user_id', 'key', 'created_at', 'contributor_name').search(params[:search])

# The comparision validates the per_page display. The minimum and maximum are arbitrarily chosen but reasonable
# Non-integer values of per_page evaluate to 0, so only valid integer values will be accepted as a param
# All other values will fail the comparison
if params[:per_page].to_i < 1 or params[:per_page].to_i > 1000
@data_sets = @all_data_sets.paginate(page: params[:page], per_page: 100)
else
@data_sets = @all_data_sets.paginate(page: params[:page], per_page: params[:per_page])
end
@fields = @project.fields
@field_count = @fields.count
@formula_fields = @project.formula_fields
Expand Down Expand Up @@ -95,7 +104,6 @@ def edit
@new_contrib_key = ContribKey.new
@new_contrib_key.project_id = @project.id
end

# POST /projects
# POST /projects.json
def create
Expand Down Expand Up @@ -687,12 +695,12 @@ def project_params
:is_template, :featured_media_id, :hidden,
:featured_at, :lock, :curated,
:curated_at, :updated_at, :default_vis,
:precision, :globals, :kml_metadata)
:precision, :globals, :kml_metadata, :per_page)
end

params[:project].permit(:content, :title, :user_id, :filter, :hidden,
:cloned_from, :has_fields, :featured_media_id,
:lock, :updated_at, :default_vis, :precision,
:globals, :kml_metadata)
:globals, :kml_metadata, :per_page)
end
end
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class User < ActiveRecord::Base

include ActionView::Helpers::SanitizeHelper

validates :name, length: { minimum: 4, maximum: 70 }, format: {
validates :name, length: { minimum: 1, maximum: 70 }, format: {
with: /\A[\p{Alpha}\p{Blank}\-\'\.]*\z/,
message: 'can only contain letters, hyphens, single quotes, periods, and spaces.' }

Expand Down
2 changes: 1 addition & 1 deletion app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<a id="more-vis-btn" class="mdl-button mdl-button--blue mdl-js-button mdl-button--raised mdl-js-ripple-effect" href="visualizations">See More Visualizations</a>
</div>
</div>
<div class="col-md-8">
<div class="col-md-8" id="featured_vis">
<iframe scrolling="no" style="width:100%;height:400px;border:0px;"
src="/visualizations/<%=@featured_vis.id%>?presentation=true">
</iframe>
Expand Down
19 changes: 18 additions & 1 deletion app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,18 @@
<% if !current_user.nil? %>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--red" id="delete_selected_button">Delete Selected</button>
<% end %>
<div class="btn-group">
<div class="btn-group" style="display:inline-flex;">
<div class="dropdown-toggle" style="padding: 0 10%;">
<%= select_tag(:display_n,
options_for_select([["100",100],
["500",500],
["1000",1000]],
@params["per_page"]),
class: "form-control",include_blank:"Per Page:")
%>

</div>

<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-check-square-o"></i>
<span class="caret"></span>
Expand Down Expand Up @@ -226,6 +237,12 @@
<p>This project has no data yet. Sign in or enter a Contributor Key to add some.</p>
<% end %>
<% end %>
<div class="text-center">
<%= will_paginate @data_sets, renderer: BootstrapPagination::Rails,
inner_window: 1, outer_window: 0, previous_label: "<<",
next_label: ">>" %>
</div>

<% end %>
</div>
</div>
Expand Down

0 comments on commit cc5af29

Please sign in to comment.