diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 012e250..906eb70 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -118,6 +118,8 @@ @template.dirty = false @template.save + flash[:notice] = _('Your template has been published and is now available to users.') + # Create a new version new_version = Template.deep_copy(@template) new_version.version = (@template.version + 1) @@ -170,7 +172,7 @@ else @template.published = false @template.save - flash[:notice] = _('Your template is no longer published.') + flash[:notice] = _('Your template is no longer published. Users will not be able to create new DMPs for this template until you re-publish it') end redirect_to admin_index_template_path(current_user.org) diff --git a/app/views/questions/_show_question.html.erb b/app/views/questions/_show_question.html.erb index 2f58792..e690b14 100644 --- a/app/views/questions/_show_question.html.erb +++ b/app/views/questions/_show_question.html.erb @@ -120,7 +120,7 @@
- <% if (@edit && question.modifiable) || question.section.phase.template.customization_of.present? %> + <% if (@edit && question.modifiable) %>
<%= hidden_field_tag :question_id, question.id, class: "question_id" %> <%= link_to _('Edit question'), '# ', class: "btn btn-primary edit_question_button"%> diff --git a/app/views/templates/_edit_template.html.erb b/app/views/templates/_edit_template.html.erb index f890fc1..d4eb721 100644 --- a/app/views/templates/_edit_template.html.erb +++ b/app/views/templates/_edit_template.html.erb @@ -19,6 +19,20 @@ + <%= _('Status') %> + + <% if hash[:live].nil? %> + <%= _('Un-published') %> + + <% elsif hash[:current].dirty? %> + <%= _('You have un-published changes') %> + + <% else %> + <%= _('Published') %> + <% end %> + + + <%= _('Created at') %> <%= l template.created_at.to_date, formats: :short %> diff --git a/app/views/templates/_show_template.html.erb b/app/views/templates/_show_template.html.erb index e2b7ab6..6a5ffa5 100644 --- a/app/views/templates/_show_template.html.erb +++ b/app/views/templates/_show_template.html.erb @@ -24,9 +24,17 @@ - <%= _('Published') %> + <%= _('Status') %> - <%= template.published %> + <% if hash[:live].nil? %> + <%= _('Un-published') %> + + <% elsif hash[:current].dirty? %> + <%= _('You have un-published changes') %> + + <% else %> + <%= _('Published') %> + <% end %> diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index 97e837c..231a00b 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -268,6 +268,7 @@ # Publish the current template put admin_publish_template_path(current) + assert_equal _('Your template has been published and is now available to users.'), flash[:notice] assert_response :redirect assert_redirected_to admin_index_template_path(@user.org) @@ -332,7 +333,7 @@ assert_not Template.live(@user.org, family).nil? put admin_unpublish_template_path(current) - assert_equal _('Your template is no longer published.'), flash[:notice] + assert_equal _('Your template is no longer published. Users will not be able to create new DMPs for this template until you re-publish it'), flash[:notice] assert_response :redirect assert_redirected_to admin_index_template_path(@user.org)