Extracted componentManager into snjs
This commit is contained in:
@@ -70,7 +70,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
src: [
|
src: [
|
||||||
'node_modules/sn-models/dist/sn-models.js',
|
'node_modules/snjs/dist/snjs.js',
|
||||||
'app/assets/javascripts/app/*.js',
|
'app/assets/javascripts/app/*.js',
|
||||||
'app/assets/javascripts/app/models/**/*.js',
|
'app/assets/javascripts/app/models/**/*.js',
|
||||||
'app/assets/javascripts/app/controllers/**/*.js',
|
'app/assets/javascripts/app/controllers/**/*.js',
|
||||||
@@ -136,7 +136,7 @@ module.exports = function(grunt) {
|
|||||||
singleQuotes: true,
|
singleQuotes: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
neeto: {
|
sn: {
|
||||||
files: {
|
files: {
|
||||||
'dist/javascripts/compiled.js': 'dist/javascripts/compiled.js',
|
'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);
|
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
|
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
||||||
if (!Array.prototype.includes) {
|
if (!Array.prototype.includes) {
|
||||||
Object.defineProperty(Array.prototype, 'includes', {
|
Object.defineProperty(Array.prototype, 'includes', {
|
||||||
|
|||||||
@@ -111,15 +111,16 @@ class ComponentView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$timeout.cancel($scope.loadTimeout);
|
$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);
|
// console.log("Reloading component", $scope.component);
|
||||||
// force iFrame to deinit, allows new one to be created
|
// force iFrame to deinit, allows new one to be created
|
||||||
$scope.componentValid = false;
|
$scope.componentValid = false;
|
||||||
componentManager.reloadComponent($scope.component).then(() => {
|
componentManager.reloadComponent($scope.component);
|
||||||
$scope.reloadStatus();
|
$scope.reloadStatus();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.reloadStatus = function(doManualReload = true) {
|
$scope.reloadStatus = function(doManualReload = true) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class PermissionsModal {
|
|||||||
this.scope = {
|
this.scope = {
|
||||||
show: "=",
|
show: "=",
|
||||||
component: "=",
|
component: "=",
|
||||||
permissions: "=",
|
permissionsString: "=",
|
||||||
callback: "="
|
callback: "="
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -31,68 +31,6 @@ class PermissionsModal {
|
|||||||
controller($scope, modelManager) {
|
controller($scope, modelManager) {
|
||||||
'ngInject';
|
'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
|
.sk-h2
|
||||||
%strong {{component.name}}
|
%strong {{component.name}}
|
||||||
would like to interact with your
|
would like to interact with your
|
||||||
{{permissionsString()}}
|
{{permissionsString}}
|
||||||
|
|
||||||
.sk-panel-row
|
.sk-panel-row
|
||||||
%p.sk-p
|
%p.sk-p
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ require "rails/test_unit/railtie"
|
|||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(*Rails.groups)
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
module Neeto
|
module StandardNotes
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Cross-Origin Resource Sharing (CORS) for Rack compatible web applications.
|
# Cross-Origin Resource Sharing (CORS) for Rack compatible web applications.
|
||||||
config.middleware.insert_before 0, Rack::Cors do
|
config.middleware.insert_before 0, Rack::Cors do
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
default: &default
|
default: &default
|
||||||
key_path: /path/to/key.pem
|
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
|
user: ssh_username
|
||||||
|
|
||||||
staging:
|
staging:
|
||||||
<<: *default
|
<<: *default
|
||||||
server: staging.yourdomain.com
|
server: staging.yourdomain.com
|
||||||
branch: staging
|
branch: staging
|
||||||
deploy_to: ~/neeto-staging-client
|
deploy_to: ~/sn-staging-client
|
||||||
|
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
server: yourdomain.com
|
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")
|
CAP_CONFIG = YAML.load_file("config/cap.yml")
|
||||||
|
|
||||||
set :application, 'neeto'
|
set :application, 'standard-notes'
|
||||||
set :repo_url, CAP_CONFIG["default"]["repo_url"]
|
set :repo_url, CAP_CONFIG["default"]["repo_url"]
|
||||||
|
|
||||||
# Default branch is :master
|
# Default branch is :master
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# 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",
|
"grunt-ng-annotate": "^3.0.0",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"sn-models": "0.1.14",
|
"snjs": "0.2.0",
|
||||||
"sn-stylekit": "2.0.14",
|
"sn-stylekit": "2.0.14",
|
||||||
"standard-file-js": "0.3.58",
|
"standard-file-js": "0.3.58",
|
||||||
"grunt-shell": "^2.1.0"
|
"grunt-shell": "^2.1.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user