-
Couldn't load subscription status.
- Fork 79
Allow artifact renaming #1715
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
antgonza
merged 6 commits into
qiita-spots:artifact-study-pages
from
josenavas:artifact-study-pages-rename-artifacts
Mar 28, 2016
Merged
Allow artifact renaming #1715
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ce64620
Adding patch operation to the artifact handler
josenavas 4150efc
fixing API
josenavas 9351dbb
Enabling user to change the artifact name
josenavas 203b8ba
Changing buttons color
josenavas 3277917
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas 9cec1f2
Addressing @antgonza
josenavas 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
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 |
|---|---|---|
|
|
@@ -45,12 +45,52 @@ | |
| load_artifact_summary(aid); | ||
| }); | ||
| } | ||
|
|
||
| /* | ||
| * | ||
| * Function to update the artifact name | ||
| * | ||
| * @param artifact_id int the artifact to be changed | ||
| * @param new_name str the new artifact name | ||
| * | ||
| * This function executes an AJAX call to update the artifact name | ||
| * and updates the interface accordingly | ||
| * | ||
| */ | ||
| function change_artifact_name(artifact_id, new_name) { | ||
| $.ajax({ | ||
| url: '/artifact/', | ||
| type: 'PATCH', | ||
| data: {'op': 'replace', 'path': '/' + artifact_id + '/name/', 'value': new_name, 'artifact_id': artifact_id}, | ||
| success: function(data) { | ||
| $("#update-artifact-name").modal('hide'); | ||
| if(data.status == 'error') { | ||
| bootstrapAlert(data.message, "danger"); | ||
| } | ||
| else { | ||
| $("#summary-title").text('Summary: ' + new_name + ' (ID: ' + artifact_id + ')'); | ||
| load_template_graph(); | ||
| } | ||
| } | ||
| }); | ||
| console.log('clicked ' + artifact_id + ' ' + new_name); | ||
|
||
| } | ||
|
|
||
| /* | ||
| * | ||
| * Allows updating the artifact name if the new artifact name is not empty | ||
| * | ||
| */ | ||
| function validate_new_name() { | ||
| $("#update-name-btn").prop('disabled', $("#new-artifact-name").val() === ""); | ||
| } | ||
| </script> | ||
| <div class='row'> | ||
| <div class='col-md-12'> | ||
| <h4> | ||
| <i>Summary: {{name}} (ID: {{artifact_id}})</i> | ||
| <i id='summary-title'>Summary: {{name}} (ID: {{artifact_id}})</i> | ||
| {% if editable %} | ||
| <a class="btn btn-default btn-sm" data-toggle="modal" data-target="#update-artifact-name"><span class="glyphicon glyphicon-pencil"></span> Edit</a> | ||
| <a class="btn btn-default btn-sm" onclick="populate_main_div('/study/process/', {artifact_id: {{artifact_id}} });"><span class="glyphicon glyphicon-play"></span> Process</a> | ||
| {% end %} | ||
| </h4> | ||
|
|
@@ -104,3 +144,22 @@ <h4> | |
| {% end %} | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Modal to update the artifact name --> | ||
| <div class="modal fade update-artifact-name" tabindex="-1" role="dialog" id="update-artifact-name"> | ||
| <div class="modal-dialog modal-md"> | ||
| <div class="modal-content"> | ||
| <div class="modal-header"> | ||
| <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
| <h3>Updating artifact {{artifact_id}} name</h3> | ||
| </div> | ||
| <div class="modal-body"> | ||
| Introduce the new name:<br/> | ||
| <input type="text" name="new-artifact-name" id="new-artifact-name" size="35" maxlength="35" onkeyup="validate_new_name();"> | ||
| <button id="update-name-btn" class="btn btn-default" onclick="change_artifact_name({{artifact_id}}, $('#new-artifact-name').val());" disabled>Update</button> | ||
| </div> | ||
| <div class="modal-footer"> | ||
| </div> | ||
| </div> | ||
| </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
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.
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.
Do we really need Summary: name, (ID: bla!)? What about name (ID: bla)?
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.
Done