-
Notifications
You must be signed in to change notification settings - Fork 42
MMT-2231 Add revisions page to published UMM-T page #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| <% content_for :header_title do %> | ||
| <h2><%= fetch_entry_id(@tool, 'tools') %></h2> | ||
| <p class="subtitle"><%= display_header_subtitle(@tool, 'tool') %></p> | ||
| <% end %> | ||
|
|
||
| <% if @errors && !@errors.empty? %> | ||
| <section class="errors"> | ||
| <div class="eui-banner--danger"> | ||
| <div class="eui-banner__message"> | ||
| <ul class="no-bullet"> | ||
| <% @errors.each do |error| %> | ||
| <li> | ||
| <%= "#{error[:field]}, " if error[:field] %> | ||
| <%= error[:error] %> | ||
| <% if error[:request_id] %> | ||
| <a href="javascript:feedback.showForm({details: '\nFill in details above this line. Please try to be as specific as possible.\n--------------------\n\nRequest ID: <%= error[:request_id] %>'});">Click here to submit feedback</a> | ||
| <% end %> | ||
| </li> | ||
| <% end %> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| </section> | ||
| <% end %> | ||
|
|
||
| <div class="row row-content"> | ||
| <section> | ||
| <h2>Revision History</h2> | ||
| </section> | ||
| <% if @error %> | ||
| <section class="errors"> | ||
| <div class="eui-banner--danger"> | ||
| <p class="eui-banner__message"> | ||
| <i class="fa fa-exclamation-triangle"></i> This tool could not be updated. You may <%= link_to 'edit', edit_tool_path(revision_id: @revision_id) %> the tool to resolve these issues. | ||
| </p> | ||
| </div> | ||
| </section> | ||
| <% end %> | ||
| <div class="row"> | ||
| <section> | ||
| <table id="tool-revisions-table"> | ||
| <thead> | ||
| <tr> | ||
| <th>Description</th> | ||
| <th>Revision Date</th> | ||
| <th>Action by</th> | ||
| <th>Actions</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <% @revisions.each_with_index do |revision, index| %> | ||
| <% revision_id = revision['meta']['revision-id'] %> | ||
| <tr class='<%= cycle("alt", "") %>'> | ||
| <td> | ||
| <% title = "View revision #{revision_id}" %> | ||
| <%= revision_id %> - | ||
| <% if revision['meta']['deleted'] == true %> | ||
| Deleted | ||
| <% elsif index == 0 %> | ||
| Published | ||
| <%# Uncomment in MMT-2232 %> | ||
| <%#= link_to 'View', tool_path(revision_id: revision_id), title: title %> | ||
| <% else %> | ||
| Revision | ||
| <%# Uncomment in MMT-2232 %> | ||
| <%#= link_to 'View', tool_path(revision_id: revision_id), title: title %> | ||
| <% end %> | ||
| </td> | ||
| <td> | ||
| <%= revision['meta']['revision-date'] %> | ||
| </td> | ||
| <td> | ||
| <%= revision['meta']['user-id'] %> | ||
| </td> | ||
| <td> | ||
| <% if @revisions.first['meta']['deleted'] == true %> | ||
| <% phrase = 'Reinstate' %> | ||
| <% confirm_phrase = 'Are you sure you want to reinstate this record?' %> | ||
| <% action = 'reinstate-tool' %> | ||
| <% else %> | ||
| <% phrase = 'Revert to this Revision' %> | ||
| <% confirm_phrase = 'Are you sure you want to revert to this revision?' %> | ||
| <% action = 'revert-tool' %> | ||
| <% end %> | ||
|
|
||
| <% unless index == 0 || revision['meta']['deleted'] == true %> | ||
| <%# Uncomment in MMT-2233 %> | ||
| <%# if current_provider?(@provider_id) %> | ||
| <%#= link_to phrase, "#revert-revisions-modal-#{revision_id}", class: 'display-modal' %> | ||
| <%# elsif available_provider?(@provider_id) %> | ||
| <%#= link_to phrase, "#not-current-provider-modal-#{revision_id}", class: 'display-modal not-current-provider', data: { 'provider': @provider_id, record_action: action } %> | ||
| <%# end %> | ||
| <!-- <div id="revert-revisions-modal-<%#= revision_id %>" class="eui-modal-content"> | ||
| <a href="#" class="modal-close float-r"><i class="fa fa-times"></i><span class="is-invisible">Close</span></a> | ||
| <p><%#= confirm_phrase %></p> | ||
| <p> | ||
| <a href="javascript:void(0)" class="eui-btn modal-close">No</a> | ||
| <%#= link_to 'Yes', revert_tool_path(revision_id: revision_id), class: 'eui-btn--blue spinner' %> | ||
| </p> | ||
| </div> | ||
| <%#= render partial: "shared/not_current_provider_modal", locals: { | ||
| modal_index: revision_id, | ||
| options: { | ||
| revisions: true, | ||
| tool: @tool, | ||
| concept_id: @concept_id, | ||
| revision_id: revision_id | ||
| } | ||
| } %> | ||
| </div> --> | ||
| <% end %> | ||
| </td> | ||
| </tr> | ||
| <% end %> | ||
| </tbody> | ||
| </table> | ||
| </section> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| describe 'Tool revision list', reset_provider: true, js: true do | ||
| context 'when viewing a published tool' do | ||
| before :all do | ||
| @ingest_response, @concept_response, @native_id = publish_tool_draft(revision_count: 2) | ||
| end | ||
|
|
||
| # TODO: remove after CMR-6332 | ||
| after :all do | ||
| delete_response = cmr_client.delete_tool('MMT_2', @native_id, 'token') | ||
|
|
||
| raise unless delete_response.success? | ||
| end | ||
|
|
||
| before do | ||
| login | ||
|
|
||
| visit tool_path(@ingest_response['concept-id']) | ||
| end | ||
|
|
||
| it 'displays the number of revisions' do | ||
| expect(page).to have_content('Revisions (2)') | ||
| end | ||
|
|
||
| context 'when clicking on the revision link' do | ||
| before do | ||
| wait_for_cmr | ||
| click_on 'Revisions' | ||
| end | ||
|
|
||
| it 'displays the revision page' do | ||
| expect(page).to have_content('Revision History') | ||
| end | ||
|
|
||
| it 'displays the tool long name' do | ||
| expect(page).to have_content(@concept_response.body['LongName']) | ||
| end | ||
|
|
||
| it 'displays when the revision was made' do | ||
| expect(page).to have_content(today_string, count: 2) | ||
| end | ||
|
|
||
| it 'displays what user made the revision' do | ||
| expect(page).to have_content('typical', count: 2) | ||
| end | ||
|
|
||
| # TODO: Uncomment in MMT-2233 | ||
| # it 'displays the correct phrasing for reverting records' do | ||
| # expect(page).to have_content('Revert to this Revision', count: 1) | ||
| # end | ||
|
|
||
| # TODO: Uncomment in MMT-2232 | ||
| # context 'when viewing an old revision' do | ||
| # link_text = 'You are viewing an older revision of this tool. Click here to view the latest published version.' | ||
| # before do | ||
| # all('a', text: 'View').last.click | ||
| # end | ||
| # | ||
| # it 'displays a message that the revision is old' do | ||
| # expect(page).to have_link(link_text) | ||
| # end | ||
| # | ||
| # it 'does not display a link to manage collection associations' do | ||
| # expect(page).to have_no_link('Manage Collection Associations') | ||
| # end | ||
| # | ||
| # context 'when clicking the message' do | ||
| # before do | ||
| # click_on link_text | ||
| # end | ||
| # | ||
| # it 'displays the latest revision to the user' do | ||
| # expect(page).to have_no_link(link_text) | ||
| # end | ||
| # end | ||
| # end | ||
| end | ||
|
|
||
| context 'when searching for the tool' do | ||
| before do | ||
| full_search(record_type: 'Tools', keyword: @concept_response.body['LongName'], provider: 'MMT_2') | ||
| end | ||
|
|
||
| it 'only displays the latest revision' do | ||
| within '#tool-search-results' do | ||
| expect(page).to have_content(@concept_response.body['LongName'], count: 1) | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know we had forms on some of our pages go through the Feedback Module. I think we should see if Rosy and Alicia know that this is being done for revisions and some drafts, and see if they would like to use it in other locations.