this.availableLayouts = window.managedRepositoryTypes;
- save=function(){
+ this.save=function(){
var valid = $("#main-content #remote-repository-edit-form").valid();
if (valid==false) {
return;
contentType: 'application/json',
dataType: 'json',
success: function(data) {
- displaySuccessMessage($.i18n.prop('remoterepository.updated'));
+ displaySuccessMessage($.i18n.prop('remoterepository.updated',self.remoteRepository.id()));
activateRemoteRepositoriesGridTab();
+ self.remoteRepository.modified(false);
},
error: function(data) {
var res = $.parseJSON(data.responseText);
}
+ this.bulkSave=function(){
+ return getModifiedRemoteRepositories().length>0;
+ }
+
+ getModifiedRemoteRepositories=function(){
+ var prx = $.grep(self.remoteRepositories(),
+ function (remoteRepository,i) {
+ return remoteRepository.modified();
+ });
+ return prx;
+ }
+
+ updateModifiedRemoteRepositories=function(){
+ var modifiedRemoteRepositories = getModifiedRemoteRepositories();
+
+ openDialogConfirm(function(){
+ for(i=0;i<modifiedRemoteRepositories.length;i++){
+ updateRemoteRepository(modifiedRemoteRepositories[i]);
+ }
+ closeDialogConfirm();
+ },
+ $.i18n.prop('ok'),
+ $.i18n.prop('cancel'),
+ $.i18n.prop('remoterepositories.bulk.save.confirm.title'),
+ $.i18n.prop('remoterepositories.bulk.save.confirm',modifiedRemoteRepositories.length));
+ }
+
+ updateRemoteRepository=function(remoteRepository){
+ var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self);
+ viewModel.save();
+ }
+
scheduleDownloadRemoteIndex=function(remoteRepository){
openDialogConfirm(
function(){
}
});
var mainContent = $("#main-content");
- ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-table").get(0));
+ ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-view").get(0));
mainContent.find("#remote-repositories-pills #remote-repositories-view-a").tab('show')
removeMediumSpinnerImg("#main-content #remote-repositories-content");
});
</ul>
<div id="remote-repositories-tabs-content" class="pill-content">
<div id="remote-repositories-view" class="pill-pane active">
+ <div id="remote-repositories-bulk-save-btn" data-bind='template:{name:"remote-repositories-bulk-save-tmpl"}'></div>
<table class="table table-striped table-bordered" id="remote-repositories-table"
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko_remote-repositoriesGrid',pageLinksId:'remote-repositoriesPagination',data:'remoteRepositories'">
</table>
{{/each}}
<th>${$.i18n.prop('edit')}</th>
<th>${$.i18n.prop('delete')}</th>
+ <th>${$.i18n.prop('modified')}</th>
<th>${$.i18n.prop('remoterepository.downloadremoteindex')}</th>
</tr>
</thead>
<img src="images/edit-cut.png" title="${$.i18n.prop('delete')}"/>
</a>
</td>
+ {{if row.modified()}}
+ <td>
+ <a href="#" class="btn btn-warning" data-bind="click: function(){ updateRemoteRepository(row) }">${$.i18n.prop('save')}</a>
+ </td>
+ {{else}}
+ <td></td>
+ {{/if}}
<td>
<a href="#" data-bind="click: function(){ scheduleDownloadRemoteIndex(row) }">
<img src="images/view-refresh.png" title="${$.i18n.prop('remoterepository.downloadremoteindex.now')}"/>
{{if bulkSave()}}
<a data-bind="click: updateModifiedManagedRepositories" class="btn btn-danger" href="#">${$.i18n.prop('save.all')}</a>
{{/if}}
+</script>
+
+<script id="remote-repositories-bulk-save-tmpl" type='text/x-jquery-tmpl'>
+ {{if bulkSave()}}
+ <a data-bind="click: updateModifiedRemoteRepositories" class="btn btn-danger" href="#">${$.i18n.prop('save.all')}</a>
+ {{/if}}
</script>
\ No newline at end of file