Commit 49b2a7bf authored by Leigh Stoller's avatar Leigh Stoller

Restore the Copy button to repo-based profiles, but when clicked, it

throws up a help modal explaining that the repo itself really needs to
be forked, and then a new profile created that points to the fork.
The text probably needs some work.
parent 9dc8fb9c
......@@ -2,7 +2,7 @@ $(function ()
{
'use strict';
var templates = APT_OPTIONS.fetchTemplateList(['manage-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'oops-modal', 'rspectextview-modal', 'publish-modal', 'share-modal', 'gitrepo-picker','profile-list-modal','confirm-delete-profile']);
var templates = APT_OPTIONS.fetchTemplateList(['manage-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'oops-modal', 'rspectextview-modal', 'publish-modal', 'share-modal', 'gitrepo-picker','profile-list-modal','confirm-delete-profile', 'copy-repobased-profile']);
var manageString = templates['manage-profile'];
var waitwaitString = templates['waitwait-modal'];
var rendererString = templates['renderer-modal'];
......@@ -14,6 +14,7 @@ $(function ()
var gitrepoString = templates['gitrepo-picker'];
var plistString = templates['profile-list-modal'];
var deleteString = templates['confirm-delete-profile'];
var copyrepoString = templates['copy-repobased-profile'];
var profile_uuid = null;
var profile_name = '';
......@@ -175,6 +176,7 @@ $(function ()
var rspectext_html = rspectextTemplate({});
$('#rspectext_div').html(rspectext_html);
$('#share_div').html(shareTemplate({formfields: fields}))
$('#copy_repobased_profile_div').html(copyrepoString);
$('#confirm_delete_div').html(deleteString);
// Extra warning in the confirm delete modal.
if (window.THIS_VERSION == window.LATEST_VERSION) {
......@@ -184,6 +186,17 @@ $(function ()
// Fireoff repo stuff now.
if (fromrepo) {
SetupRepo();
// Handler for the copy repobased profile help modal.
// Need to fill in the URL.
$('#copy-repobased-profile-modal input')
.val(fields["profile_repourl"]);
$('#copy-repobased-profile-modal .copy-to-clipboard')
.click(function (e) {
e.preventDefault();
$('#copy-repobased-profile-modal .gitrepo-url').select();
document.execCommand("copy");
});
}
//
......
......@@ -2,7 +2,7 @@ $(function ()
{
'use strict';
var templates = APT_OPTIONS.fetchTemplateList(['show-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'rspectextview-modal', 'instantiate-modal', 'oops-modal', 'share-modal']);
var templates = APT_OPTIONS.fetchTemplateList(['show-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'rspectextview-modal', 'instantiate-modal', 'oops-modal', 'share-modal', 'copy-repobased-profile']);
var showString = templates['show-profile'];
var waitwaitString = templates['waitwait-modal'];
var rendererString = templates['renderer-modal'];
......@@ -11,6 +11,7 @@ $(function ()
var instantiateString = templates['instantiate-modal'];
var oopsString = templates['oops-modal'];
var shareString = templates['share-modal'];
var copyrepoString = templates['copy-repobased-profile'];
var profile_uuid = null;
var profile_name = '';
......@@ -88,11 +89,23 @@ $(function ()
$('#instantiate_div').html(instantiate_html);
$('#rspectext_div').html(rspectextviewString);
$('#oops_div').html(oopsString);
$('#copy_repobased_profile_div').html(copyrepoString);
$('#share_div').html(shareTemplate({formfields: fields}))
// Fireoff repo stuff now.
if (fromrepo) {
SetupRepo();
// Handler for the copy repobased profile help modal.
// Need to fill in the URL.
$('#copy-repobased-profile-modal input')
.val(fields["profile_repourl"]);
$('#copy-repobased-profile-modal .copy-to-clipboard')
.click(function (e) {
e.preventDefault();
$('#copy-repobased-profile-modal .gitrepo-url').select();
document.execCommand("copy");
});
}
// This activates the popover subsystem.
......
......@@ -240,7 +240,7 @@ function SPITFORM($formfields, $errors)
AddLibrary("js/gitrepo.js");
SPITREQUIRE("js/manage_profile.js");
AddTemplateList(array('manage-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'oops-modal', 'rspectextview-modal', 'publish-modal', 'share-modal', 'gitrepo-picker', 'profile-list-modal', 'confirm-delete-profile'));
AddTemplateList(array('manage-profile', 'waitwait-modal', 'renderer-modal', 'showtopo-modal', 'oops-modal', 'rspectextview-modal', 'publish-modal', 'share-modal', 'gitrepo-picker', 'profile-list-modal', 'confirm-delete-profile', "copy-repobased-profile"));
SPITFOOTER();
}
......
......@@ -177,7 +177,7 @@ SPITREQUIRE("js/show-profile.js",
"<script src='js/lib/jquery-ui.js'></script>\n".
"<script src='js/lib/jquery.appendGrid-1.3.1.min.js'></script>");
AddTemplateList(array("show-profile", "waitwait-modal", "renderer-modal", "showtopo-modal", "rspectextview-modal", "instantiate-modal", "oops-modal", "share-modal", "gitrepo-picker"));
AddTemplateList(array("show-profile", "waitwait-modal", "renderer-modal", "showtopo-modal", "rspectextview-modal", "instantiate-modal", "oops-modal", "share-modal", "gitrepo-picker", "copy-repobased-profile"));
SPITFOOTER();
?>
<!-- How to make a copy of a repo-based profile -->
<div id='copy-repobased-profile-modal' class='modal fade'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class="close"
data-dismiss='modal' aria-hidden='true'>&times;</button>
<center><h4>How To Copy a Repository Based Profile</h4></center>
</div>
<div class='modal-body'>
<p>
In order to make a copy of a repository based profile, you
first need to make a <em>fork</em> of the git repository at
any code management web site that supports publically readable
Git repositories (ie:
<a href="https://www.github.com/" target="_blank">GitHub</a>,
<a href="https://www.gitlab.com/" target="_blank">GitLab</a>, or
<a href="https://www.bitbucket.org/" target="_blank">Bitbucket</a>).
The URL for the original git repository that you need to fork is:
<div class="col-xs-8 col-xs-offset-2">
<input readonly type="text"
class="form-control input-sm gitrepo-url"
style="display: inline; width: 95%;
padding-left: 3px; padding-right: 3px;
padding-bottom: 0px; padding-top: 0px;"
value="foo bar fee">
<a href='#' class='btn btn-xs copy-to-clipboard'
style="display: inline; padding: 0px">
<span class='glyphicon glyphicon-copy'
style='margin-bottom: 4px;'></span>
</a>
</div>
<div class="clearfix"></div>
</p>
<p>
Be sure to make your new git repository publically readable
so that the Portal can access it.
</p>
<p>
Once your fork is created, use the
<a href="manage_profile.php" target="_blank">Create Profile</a>
page to create a new profile that is linked to your new
(forked) git repository.
</p>
</div>
</div>
</div>
</div>
......@@ -716,24 +716,27 @@
style='margin-right: 10px;'
type='submit' name='create'>Instantiate
</a>
<% if (!fromrepo) { %>
<a class='btn btn-primary btn-xs pull-left'
id='profile_copy_button'
style='margin-right: 10px;'
type='button'
<% if (fromrepo) { %>
data-toggle='modal'
data-target='#copy-repobased-profile-modal'
<% } else { %>
href='manage_profile.php?action=copy&uuid=<%= version_uuid %>'
data-toggle='popover'
data-delay='{"hide":1500, "show":250}'
data-html='true'
data-content="When you <em>copy</em> (instead of
clone), you are creating a new profile that
uses the same source code and metadata (description,
instructions) as the original profile, but without
creating a new disk image. Instead, the new profile uses
whatever images the original profile uses.">
clone), you are creating a new profile that
uses the same source code and metadata (description,
instructions) as the original profile, but without
creating a new disk image. Instead, the new profile
uses whatever images the original profile uses."
<% } %>
type='button'>
Copy
</a>
<% } %>
<span class='pull-left'
data-toggle='popover'
data-delay='{"hide":1500, "show":250}'
......@@ -1207,6 +1210,7 @@ Instructions are optional.
<div id='profile_list_modal_div'></div>
<div id='share_div'></div>
<div id='confirm_delete_div'></div>
<div id='copy_repobased_profile_div'></div>
</div>
<% if (viewing && Object.keys(versions).length > 1) { %>
<div class='row'>
......
......@@ -214,14 +214,17 @@
name='create'>Instantiate
</button>
<% } %>
<% if (!fromrepo) { %>
<a class='btn btn-primary btn-xs pull-right'
<a id="copy-profile-button"
class='btn btn-primary btn-xs pull-right'
style='margin-right: 10px;'
type='button'
href='manage_profile.php?action=copy&uuid=<%= version_uuid %>'>
<% if (fromrepo) { %>
data-toggle='modal' data-target='#copy-repobased-profile-modal'
<% } else { %>
href='manage_profile.php?action=copy&uuid=<%= version_uuid %>'
<% } %>
type='button'>
Copy
</a>
<% } %>
<% } %>
<% if (canedit) { %>
<a class='btn btn-primary btn-xs pull-right'
......@@ -260,8 +263,8 @@
<div id='publish_div'></div>
<div id='instantiate_div'></div>
<div id='rspectext_div'></div>
<div id='share_div'>
</div>
<div id='share_div'></div>
<div id='copy_repobased_profile_div'></div>
</div>
<div class='row hidden' id="gitpicker-div">
<div class='col-sm-12'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment