conditional show extensions
This commit is contained in:
@@ -63,7 +63,7 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
})
|
||||
.controller('EditorCtrl', function ($sce, $timeout, apiController, markdownRenderer, $rootScope) {
|
||||
.controller('EditorCtrl', function ($sce, $timeout, apiController, markdownRenderer, $rootScope, extensionManager) {
|
||||
|
||||
this.setNote = function(note, oldNote) {
|
||||
this.editorMode = 'edit';
|
||||
@@ -81,6 +81,10 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
|
||||
this.hasAvailableExtensions = function() {
|
||||
return extensionManager.extensionsInContextOfItem(this.note).length > 0;
|
||||
}
|
||||
|
||||
this.onPreviewDoubleClick = function() {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(100);
|
||||
|
||||
@@ -50,8 +50,11 @@ angular.module('app.frontend')
|
||||
extensionManager.addExtension(this.newExtensionData.url, function(response){
|
||||
if(!response) {
|
||||
alert("Unable to register this extension. Make sure the link is valid and try again.");
|
||||
} else {
|
||||
this.newExtensionData.url = "";
|
||||
this.showNewExtensionForm = false;
|
||||
}
|
||||
})
|
||||
}.bind(this))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
%li{"ng-click" => "ctrl.deleteNote()"}
|
||||
.text Delete
|
||||
%li.sep
|
||||
%li.dropdown
|
||||
%li.dropdown{"ng-if" => "ctrl.hasAvailableExtensions()"}
|
||||
%a.dropdown-toggle{"ng-click" => "ctrl.showExtensions = !ctrl.showExtensions; ctrl.showMenu = false"}
|
||||
Extensions
|
||||
%span.caret
|
||||
|
||||
@@ -51,19 +51,19 @@
|
||||
.email {{ctrl.user.email}}
|
||||
.server {{ctrl.serverData.url}}
|
||||
.links{"ng-if" => "ctrl.user.email"}
|
||||
.link-item
|
||||
%a{"ng-click" => "ctrl.changePasswordPressed()"} Change Password
|
||||
%form.account-form{"ng-if" => "ctrl.showNewPasswordForm", 'ng-submit' => 'ctrl.submitPasswordChange()', 'name' => "passwordChangeForm"}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control.login-input{:autofocus => 'autofocus', :name => 'current', :placeholder => 'Current password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.current_password'}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control.login-input{:placeholder => 'New password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.new_password', "autocomplete" => "new-password"}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control.login-input{:placeholder => 'Confirm password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.new_password_confirmation', "autocomplete" => "new-password"}
|
||||
%button.btn.dark-button.btn-block{:type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
%span.ladda-label Change Password
|
||||
.panel-status-text{"ng-if" => "ctrl.passwordChangeData.status", "style" => "font-size: 14px;"}
|
||||
{{ctrl.passwordChangeData.status}}
|
||||
-# .link-item
|
||||
-# %a{"ng-click" => "ctrl.changePasswordPressed()"} Change Password
|
||||
-# %form.account-form{"ng-if" => "ctrl.showNewPasswordForm", 'ng-submit' => 'ctrl.submitPasswordChange()', 'name' => "passwordChangeForm"}
|
||||
-# .form-tag.has-feedback
|
||||
-# %input.form-control.login-input{:autofocus => 'autofocus', :name => 'current', :placeholder => 'Current password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.current_password'}
|
||||
-# .form-tag.has-feedback
|
||||
-# %input.form-control.login-input{:placeholder => 'New password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.new_password', "autocomplete" => "new-password"}
|
||||
-# .form-tag.has-feedback
|
||||
-# %input.form-control.login-input{:placeholder => 'Confirm password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'ctrl.passwordChangeData.new_password_confirmation', "autocomplete" => "new-password"}
|
||||
-# %button.btn.dark-button.btn-block{:type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
-# %span.ladda-label Change Password
|
||||
-# .panel-status-text{"ng-if" => "ctrl.passwordChangeData.status", "style" => "font-size: 14px;"}
|
||||
-# {{ctrl.passwordChangeData.status}}
|
||||
.link-item
|
||||
%a{"ng-click" => "ctrl.signOutPressed()"} Sign Out
|
||||
.meta-container
|
||||
|
||||
11
vendor/assets/javascripts/transpiled.js
vendored
11
vendor/assets/javascripts/transpiled.js
vendored
@@ -515,7 +515,7 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
});
|
||||
}
|
||||
};
|
||||
}).controller('EditorCtrl', function ($sce, $timeout, apiController, markdownRenderer, $rootScope) {
|
||||
}).controller('EditorCtrl', function ($sce, $timeout, apiController, markdownRenderer, $rootScope, extensionManager) {
|
||||
|
||||
this.setNote = function (note, oldNote) {
|
||||
this.editorMode = 'edit';
|
||||
@@ -533,6 +533,10 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
}
|
||||
};
|
||||
|
||||
this.hasAvailableExtensions = function () {
|
||||
return extensionManager.extensionsInContextOfItem(this.note).length > 0;
|
||||
};
|
||||
|
||||
this.onPreviewDoubleClick = function () {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(100);
|
||||
@@ -762,8 +766,11 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
extensionManager.addExtension(this.newExtensionData.url, function (response) {
|
||||
if (!response) {
|
||||
alert("Unable to register this extension. Make sure the link is valid and try again.");
|
||||
} else {
|
||||
this.newExtensionData.url = "";
|
||||
this.showNewExtensionForm = false;
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
2
vendor/assets/javascripts/transpiled.js.map
vendored
2
vendor/assets/javascripts/transpiled.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user