diff --git a/app/assets/stylesheets/datasets.css.scss b/app/assets/stylesheets/datasets.css.scss index d668c63f..cbfd8ec3 100644 --- a/app/assets/stylesheets/datasets.css.scss +++ b/app/assets/stylesheets/datasets.css.scss @@ -391,4 +391,4 @@ ul#downloaders { .help-text {display: block; color: #737373; } &:after {content: ''; clear: both; display: block; } ul>li {list-style-type: disc; list-style-position: inside; line-height: 0.7em;} -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index 7b3aa879..82a0064d 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -764,9 +764,15 @@ div#actions + div#info { margin-bottom: 7px; } -.show_download_link_modal .close_hint { +.show_download_link_modal { + .security-alert { + color: red; + margin: 0px; + } + .close_hint { color: #8A8A8A; margin: 5px 0 0 0; + } } #modal { top: 20px; } @@ -996,4 +1002,4 @@ noscript { } } .right { float: right !important;} -.left { float: left !important;} \ No newline at end of file +.left { float: left !important;} diff --git a/app/controllers/datasets_controller.rb b/app/controllers/datasets_controller.rb index 20a4e0a4..2116d99a 100644 --- a/app/controllers/datasets_controller.rb +++ b/app/controllers/datasets_controller.rb @@ -165,7 +165,7 @@ def show end def index - datasets = Dataset.select("id, title") + datasets = Dataset.select("id, title").order(:id) respond_to do |format| format.json { render :json => datasets } diff --git a/app/models/datacolumn.rb b/app/models/datacolumn.rb index 3ba74ad1..623e2e57 100644 --- a/app/models/datacolumn.rb +++ b/app/models/datacolumn.rb @@ -64,12 +64,10 @@ def predefined? # override the datagroup method. # when datagroup is not assigned, used NullDatagroup instead. + alias fetch_datagroup_via_datagroup_id datagroup + private :fetch_datagroup_via_datagroup_id def datagroup - if self.datagroup_id - Datagroup.where(id: datagroup_id).first - else - NullDatagroup.new - end + fetch_datagroup_via_datagroup_id || NullDatagroup.new end # returns the first 'count' number unique imported values diff --git a/app/models/paperproposal.rb b/app/models/paperproposal.rb index 647f37b8..53d6b572 100644 --- a/app/models/paperproposal.rb +++ b/app/models/paperproposal.rb @@ -33,9 +33,6 @@ class Paperproposal < ActiveRecord::Base :source => :paperproposal_votes, :conditions => {:project_board_vote => true } has_many :for_data_request_votes, :class_name => "PaperproposalVote", :source => :paperproposal_votes, :conditions => {:project_board_vote => false } - # has_many through association with User model via paperproposal_votes joint table. - has_many :coordinators, :class_name => "User", :source => :user, :through => :paperproposal_votes, - :conditions => ['project_board_vote = ?',true] # habtm association with Dataset model. before_destroy :reset_download_rights # needs to be before association definition,see https://rails.lighthouseapp.com/projects/8994/tickets/4386 @@ -45,9 +42,6 @@ class Paperproposal < ActiveRecord::Base # one-to-many association with Freeformat model. has_many :freeformats, :as => :freeformattable, :dependent => :destroy - scope :has_state, lambda{|s| where(:state=>s)} - accepts_nested_attributes_for :authors - validates_presence_of :title, :rationale, :author_id STATES = { diff --git a/app/views/datasets/_popup_display_download_url.haml b/app/views/datasets/_popup_display_download_url.haml index 44c3c301..16d0fda5 100644 --- a/app/views/datasets/_popup_display_download_url.haml +++ b/app/views/datasets/_popup_display_download_url.haml @@ -25,12 +25,22 @@ \| %a{:href => '#', :class => 'show_eml_url'} EML + - if current_user + %p.security-alert The link contains your user credentials, Please DO NOT share with others. %textarea.download_urls{:readonly => 'readonly', :onclick => 'this.focus();this.select()'} = url_csv_categories %p.close_hint Click somewhere outside or press ESC to close :javascript + function alert_if_with_user_credential() { + if($("##{modal_id} .download_urls").val().indexOf("user_credential") != -1 ) { + $(".security-alert").fadeIn('fast'); + } + else { + $(".security-alert").fadeOut('fast'); + } + } $("##{link_id}").click(function(e) { $("##{modal_id}").modal( { @@ -40,14 +50,17 @@ ); $("##{modal_id} .show_csv_url_with_categories").click(function(e) { $("##{modal_id} .download_urls").val("#{url_csv_categories}"); + alert_if_with_user_credential() e.preventDefault(); }); $("##{modal_id} .show_csv_url_without_categories").click(function(e) { $("##{modal_id} .download_urls").val("#{url_csv_plain}"); + alert_if_with_user_credential() e.preventDefault(); }); $("##{modal_id} .show_eml_url").click(function(e) { $("##{modal_id} .download_urls").val("#{url_eml}"); + alert_if_with_user_credential() e.preventDefault(); }); e.preventDefault();