Extracted componentManager into snjs
This commit is contained in:
@@ -70,7 +70,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
app: {
|
||||
src: [
|
||||
'node_modules/sn-models/dist/sn-models.js',
|
||||
'node_modules/snjs/dist/snjs.js',
|
||||
'app/assets/javascripts/app/*.js',
|
||||
'app/assets/javascripts/app/models/**/*.js',
|
||||
'app/assets/javascripts/app/controllers/**/*.js',
|
||||
@@ -136,7 +136,7 @@ module.exports = function(grunt) {
|
||||
singleQuotes: true,
|
||||
},
|
||||
|
||||
neeto: {
|
||||
sn: {
|
||||
files: {
|
||||
'dist/javascripts/compiled.js': 'dist/javascripts/compiled.js',
|
||||
},
|
||||
|
||||
@@ -55,11 +55,6 @@ Array.prototype.containsPrimitiveSubset = function(array) {
|
||||
return !array.some(val => this.indexOf(val) === -1);
|
||||
}
|
||||
|
||||
/* Use with numbers and strings, not objects */
|
||||
Array.prototype.containsObjectSubset = function(array) {
|
||||
return !array.some(val => !_.find(this, val));
|
||||
}
|
||||
|
||||
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
||||
if (!Array.prototype.includes) {
|
||||
Object.defineProperty(Array.prototype, 'includes', {
|
||||
|
||||
@@ -111,15 +111,16 @@ class ComponentView {
|
||||
}
|
||||
|
||||
$timeout.cancel($scope.loadTimeout);
|
||||
componentManager.registerComponentWindow(component, iframe.contentWindow);
|
||||
componentManager.registerComponentWindow(component, iframe.contentWindow).then(() => {
|
||||
// Add small timeout to, as $scope.loading controls loading overlay,
|
||||
// which is used to avoid flicker when enabling extensions while having an enabled theme
|
||||
// we don't use ng-show because it causes problems with rendering iframes after timeout, for some reason.
|
||||
$timeout(() => {
|
||||
$scope.loading = false;
|
||||
$scope.issueLoading = desktopError; /* Typically we'd just set this to false at this point, but we now account for desktopError */
|
||||
}, 7)
|
||||
})
|
||||
|
||||
// Add small timeout to, as $scope.loading controls loading overlay,
|
||||
// which is used to avoid flicker when enabling extensions while having an enabled theme
|
||||
// we don't use ng-show because it causes problems with rendering iframes after timeout, for some reason.
|
||||
$timeout(() => {
|
||||
$scope.loading = false;
|
||||
$scope.issueLoading = desktopError; /* Typically we'd just set this to false at this point, but we now account for desktopError */
|
||||
}, 7)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -158,9 +159,8 @@ class ComponentView {
|
||||
// console.log("Reloading component", $scope.component);
|
||||
// force iFrame to deinit, allows new one to be created
|
||||
$scope.componentValid = false;
|
||||
componentManager.reloadComponent($scope.component).then(() => {
|
||||
$scope.reloadStatus();
|
||||
});
|
||||
componentManager.reloadComponent($scope.component);
|
||||
$scope.reloadStatus();
|
||||
}
|
||||
|
||||
$scope.reloadStatus = function(doManualReload = true) {
|
||||
|
||||
@@ -6,7 +6,7 @@ class PermissionsModal {
|
||||
this.scope = {
|
||||
show: "=",
|
||||
component: "=",
|
||||
permissions: "=",
|
||||
permissionsString: "=",
|
||||
callback: "="
|
||||
};
|
||||
}
|
||||
@@ -31,68 +31,6 @@ class PermissionsModal {
|
||||
controller($scope, modelManager) {
|
||||
'ngInject';
|
||||
|
||||
$scope.permissionsString = function() {
|
||||
var finalString = "";
|
||||
let permissionsCount = $scope.permissions.length;
|
||||
|
||||
let addSeparator = (index, length) => {
|
||||
if(index > 0) {
|
||||
if(index == length - 1) {
|
||||
if(length == 2) {
|
||||
return " and ";
|
||||
} else {
|
||||
return ", and "
|
||||
}
|
||||
} else {
|
||||
return ", ";
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
$scope.permissions.forEach((permission, index) => {
|
||||
|
||||
if(permission.name === "stream-items") {
|
||||
var types = permission.content_types.map(function(type){
|
||||
var desc = modelManager.humanReadableDisplayForContentType(type);
|
||||
if(desc) {
|
||||
return desc + "s";
|
||||
} else {
|
||||
return "items of type " + type;
|
||||
}
|
||||
})
|
||||
var typesString = "";
|
||||
|
||||
for(var i = 0;i < types.length;i++) {
|
||||
var type = types[i];
|
||||
typesString += addSeparator(i, types.length + permissionsCount - index - 1);
|
||||
typesString += type;
|
||||
}
|
||||
|
||||
finalString += addSeparator(index, permissionsCount);
|
||||
|
||||
finalString += typesString;
|
||||
|
||||
if(types.length >= 2 && index < permissionsCount - 1) {
|
||||
// If you have a list of types, and still an additional root-level permission coming up, add a comma
|
||||
finalString += ", ";
|
||||
}
|
||||
} else if(permission.name === "stream-context-item") {
|
||||
var mapping = {
|
||||
"editor-stack" : "working note",
|
||||
"note-tags" : "working note",
|
||||
"editor-editor": "working note"
|
||||
}
|
||||
|
||||
finalString += addSeparator(index, permissionsCount, true);
|
||||
|
||||
finalString += mapping[$scope.component.area];
|
||||
}
|
||||
})
|
||||
|
||||
return finalString + ".";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
.sk-h2
|
||||
%strong {{component.name}}
|
||||
would like to interact with your
|
||||
{{permissionsString()}}
|
||||
{{permissionsString}}
|
||||
|
||||
.sk-panel-row
|
||||
%p.sk-p
|
||||
|
||||
@@ -14,7 +14,7 @@ require "rails/test_unit/railtie"
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module Neeto
|
||||
module StandardNotes
|
||||
class Application < Rails::Application
|
||||
# Cross-Origin Resource Sharing (CORS) for Rack compatible web applications.
|
||||
config.middleware.insert_before 0, Rack::Cors do
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
default: &default
|
||||
key_path: /path/to/key.pem
|
||||
repo_url: https://github.com/neeto-project/neeto-web-client.git
|
||||
repo_url: https://github.com/sn-project/sn-web-client.git
|
||||
user: ssh_username
|
||||
|
||||
staging:
|
||||
<<: *default
|
||||
server: staging.yourdomain.com
|
||||
branch: staging
|
||||
deploy_to: ~/neeto-staging-client
|
||||
deploy_to: ~/sn-staging-client
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
server: yourdomain.com
|
||||
deploy_to: ~/neeto-prod-client
|
||||
deploy_to: ~/sn-prod-client
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
CAP_CONFIG = YAML.load_file("config/cap.yml")
|
||||
|
||||
set :application, 'neeto'
|
||||
set :application, 'standard-notes'
|
||||
set :repo_url, CAP_CONFIG["default"]["repo_url"]
|
||||
|
||||
# Default branch is :master
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.session_store :cookie_store, key: '_neeto_session'
|
||||
Rails.application.config.session_store :cookie_store, key: '_sn_session'
|
||||
|
||||
2762
package-lock.json
generated
2762
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@
|
||||
"grunt-ng-annotate": "^3.0.0",
|
||||
"mocha": "^5.2.0",
|
||||
"serve-static": "^1.13.2",
|
||||
"sn-models": "0.1.14",
|
||||
"snjs": "0.2.0",
|
||||
"sn-stylekit": "2.0.14",
|
||||
"standard-file-js": "0.3.58",
|
||||
"grunt-shell": "^2.1.0"
|
||||
|
||||
Reference in New Issue
Block a user