implement first time popup logic

This commit is contained in:
zmagod 2016-08-25 11:44:49 +02:00
parent c38a4e2614
commit 5fabe06b8d
5 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,10 @@
(function(){
// display introductory modal
if( Cookies.get('popup-already-shown') !== 'yes'){
$("#introductory-popup-modal").modal('show',{
backdrop: true,
keyboard: false,
});
Cookies.set('popup-already-shown', 'yes');
}
})();

View file

@ -130,6 +130,10 @@
</div>
<% end %>
<% if current_user.created_at < Time.new(2016, 8, 25) %>
<%= render partial: 'projects/index/introductory_popup' %>
<%= javascript_include_tag "projects/introdutory_popup"%>
<% end %>
<% if @projects_by_orgs.length > 0 %>
<% @projects_by_orgs.each do |org, projects| %>
<%= render partial: "projects/index/org_projects", locals: {org: org, projects: projects} %>

View file

@ -0,0 +1,17 @@
<!-- introductory popup modal -->
<div class="modal" id="introductory-popup-modal" tabindex="-1" role="dialog" aria-labelledby="introductory-modal-label">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="introductory-modal-label"><%=t 'introductory.popup-title' %></h4>
</div>
<div class="modal-body">
// TODO
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t 'general.cancel' %></button>
</div>
</div>
</div>
</div>

View file

@ -57,3 +57,4 @@ Rails.application.config.assets.precompile += %w( reports_pdf.css )
Rails.application.config.assets.precompile += %w( jszip.min.js )
Rails.application.config.assets.precompile += %w( assets.js )
Rails.application.config.assets.precompile += %w( projects/show.js )
Rails.application.config.assets.precompile += %w( projects/introdutory_popup.js )

View file

@ -1480,6 +1480,8 @@ en:
new_report_click_org_html: "Click on <strong>%{private_org}</strong> in breadcrumbs to return to the Dashboard."
archive_project_html: "Archive demo project by clicking on the down arrow <span class='glyphicon glyphicon-triangle-bottom'></span>. You can always access the archive by clicking the <span class='glyphicon glyphicon-briefcase'></span> button on the top right side of the dashboard and restore any item you have archived."
introductory:
popup-title: "Dear sciNote user,"
# This section contains general words that can be used in any parts of
# application.