Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzapp committed Dec 5, 2017
2 parents d95c7a3 + d004cb4 commit ca0f532
Show file tree
Hide file tree
Showing 35 changed files with 675 additions and 221 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hashbrown-cms",
"repository": "https://github.com/Putaitu/hashbrown-cms.git",
"version": "1.0.1",
"version": "1.0.2",
"description": "The pluggable CMS",
"main": "hashbrown.js",
"scripts": {
Expand Down
49 changes: 47 additions & 2 deletions public/css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,46 @@ h1, h2, h3, h4, h5, h6 {
.page--login__login__body .widget {
margin-bottom: 1rem; }

.page--error {
background-color: #21303b;
color: #ffffff;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-image: url("/img/bg-secondary.jpg");
background-attachment: fixed;
background-position: 0px 0px; }
.page--error .widget:not(:last-child) {
margin-bottom: 4rem; }
.page--error__logo {
max-width: 10rem;
margin: 0 auto; }

.page--setup {
background-color: #21303b;
height: 100%;
background-image: url("/img/bg-secondary.jpg");
background-attachment: fixed;
background-position: 0px 0px; }
.page--setup__step {
position: fixed;
top: 50%;
left: 50%;
width: 374px;
transform: translate(-50%, -50%);
padding: 40px;
color: #ffffff;
background-color: transparent;
text-align: center; }
.page--setup__step__heading {
margin-bottom: 2rem; }
.page--setup__step__heading h2 {
margin-top: 0px; }
.page--setup__step__body .widget {
margin-bottom: 1rem; }

/**
* The dashboard page
*/
Expand Down Expand Up @@ -1624,9 +1664,12 @@ h1, h2, h3, h4, h5, h6 {
font-weight: 700;
border-radius: 0.2rem;
line-height: 2rem;
padding: 0 0.5rem; }
padding: 0 0.5rem;
max-width: calc(100% - 2rem); }
.widget--message.expanded {
width: 100%; }
.widget--message.large {
padding: 1rem 2rem; }
.widget--message.fixed {
position: fixed;
z-index: 900; }
Expand Down Expand Up @@ -1664,7 +1707,9 @@ h1, h2, h3, h4, h5, h6 {
font-weight: bold;
text-align: center;
text-transform: uppercase;
color: #21303b; }
color: #333333; }
.widget--separator.secondary {
color: #ffffff; }

/**
* A generic label
Expand Down
18 changes: 13 additions & 5 deletions public/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18063,15 +18063,15 @@ var UserEditor = function (_HashBrown$Views$Moda) {
return [this.renderField('Username', this.renderUserNameEditor()), this.renderField('Full name', this.renderFullNameEditor()), this.renderField('Email', this.renderEmailEditor()), this.renderField('Password', this.renderPasswordEditor()), _.div({ class: 'widget widget--label warning hidden editor--user__password-warning' }), _.if(currentUserIsAdmin() && !this.hidePermissions, this.renderField('Is admin', this.renderAdminEditor()), _.if(!this.model.isAdmin, _.div({ class: 'widget widget--separator' }, 'Projects'), _.each(this.projects, function (i, project) {
return _.div({ class: 'widget-group' }, new HashBrown.Views.Widgets.Input({
type: 'checkbox',
value: _this9.model.hasScope(project),
value: _this9.model.hasScope(project.id),
onChange: function onChange(newValue) {
if (newValue) {
_this9.model.giveScope(project);
_this9.model.giveScope(project.id);
} else {
_this9.model.removeScope(project);
_this9.model.removeScope(project.id);
}
}
}).$element, _.div({ class: 'widget widget--label' }, project), _this9.renderScopesEditor(project));
}).$element, _.div({ class: 'widget widget--label' }, project.settings.info.name), _this9.renderScopesEditor(project.id));
})))];
};

Expand Down Expand Up @@ -43968,6 +43968,8 @@ var ContentPane = function (_NavbarPane) {

schemaReference.pickFirstSchema();

schemaReference.$element.addClass('widget');

// Render the confirmation modal
UI.confirmModal('OK', 'Create new content', _.div({ class: 'widget-group' }, _.label({ class: 'widget widget--label' }, 'Schema'), schemaReference.$element),

Expand Down Expand Up @@ -46862,7 +46864,13 @@ var ContentSchemaReferenceEditor = function (_FieldEditor) {


ContentSchemaReferenceEditor.prototype.pickFirstSchema = function pickFirstSchema() {
this.value = this.getDropdownOptions()[0].id;
var options = this.getDropdownOptions();

if (options.length < 1) {
return;
}

this.value = options[0].id;

this.trigger('change', this.value);

Expand Down
75 changes: 27 additions & 48 deletions public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -17280,15 +17280,15 @@ var UserEditor = function (_HashBrown$Views$Moda) {
return [this.renderField('Username', this.renderUserNameEditor()), this.renderField('Full name', this.renderFullNameEditor()), this.renderField('Email', this.renderEmailEditor()), this.renderField('Password', this.renderPasswordEditor()), _.div({ class: 'widget widget--label warning hidden editor--user__password-warning' }), _.if(currentUserIsAdmin() && !this.hidePermissions, this.renderField('Is admin', this.renderAdminEditor()), _.if(!this.model.isAdmin, _.div({ class: 'widget widget--separator' }, 'Projects'), _.each(this.projects, function (i, project) {
return _.div({ class: 'widget-group' }, new HashBrown.Views.Widgets.Input({
type: 'checkbox',
value: _this9.model.hasScope(project),
value: _this9.model.hasScope(project.id),
onChange: function onChange(newValue) {
if (newValue) {
_this9.model.giveScope(project);
_this9.model.giveScope(project.id);
} else {
_this9.model.removeScope(project);
_this9.model.removeScope(project.id);
}
}
}).$element, _.div({ class: 'widget widget--label' }, project), _this9.renderScopesEditor(project));
}).$element, _.div({ class: 'widget widget--label' }, project.settings.info.name), _this9.renderScopesEditor(project.id));
})))];
};

Expand Down Expand Up @@ -36462,7 +36462,7 @@ HashBrown.Helpers.RequestHelper.request('get', 'user').then(function (user) {

User.current = new User(user);

return HashBrown.Helpers.RequestHelper.request('get', 'server/projects');
return HashBrown.Helpers.RequestHelper.request('get', 'server/projects?ids=true');
})

// --------------------
Expand Down Expand Up @@ -36812,7 +36812,6 @@ var ProjectEditor = function (_Crisp$View) {
var modal = UI.confirmModal('Remove', 'Remove environment "' + environmentName + '"', 'Are you sure want to remove the environment "' + environmentName + '" from the project "' + (this.model.settings.info.name || this.model.id) + '"?', function () {
RequestHelper.request('delete', 'server/projects/' + _this3.model.id + '/' + environmentName).then(function () {
_this3.model = null;

_this3.fetch();
}).catch(UI.errorModal);
});
Expand All @@ -36829,7 +36828,7 @@ var ProjectEditor = function (_Crisp$View) {
return;
}

var infoEditor = new InfoEditor({ projectId: this.model.id });
var infoEditor = new InfoEditor({ modelUrl: '/api/server/projects/' + this.model.id });

infoEditor.on('change', function (newInfo) {
_this4.model = null;
Expand All @@ -36849,9 +36848,12 @@ var ProjectEditor = function (_Crisp$View) {
return;
}

var syncEditor = new SyncEditor({ projectId: this.model.id });
var syncEditor = new SyncEditor({
projectId: this.model.id,
modelUrl: '/api/' + this.model.id + '/settings/sync'
});

syncEditor.on('change', function (syncSettings) {
syncEditor.on('change', function (newSettings) {
_this5.model = null;
_this5.fetch();
});
Expand All @@ -36869,7 +36871,7 @@ var ProjectEditor = function (_Crisp$View) {
return;
}

var languageEditor = new LanguageEditor({ projectId: this.model.id });
var languageEditor = new LanguageEditor({ modelUrl: '/api/server/projects/' + this.model.id });

languageEditor.on('change', function () {
_this6.model = null;
Expand All @@ -36889,7 +36891,7 @@ var ProjectEditor = function (_Crisp$View) {
return;
}

var backupEditor = new BackupEditor({ modelUrl: this.modelUrl });
var backupEditor = new BackupEditor({ modelUrl: '/api/server/projects/' + this.model.id });

backupEditor.on('change', function () {
_this7.model = null;
Expand Down Expand Up @@ -36944,13 +36946,10 @@ var ProjectEditor = function (_Crisp$View) {
return false;
}

_this9.model.environments.push(environmentName);

RequestHelper.request('put', 'server/projects/' + _this9.model.id + '/' + environmentName).then(function () {
modal.close();

_this9.model = null;

_this9.fetch();
}).catch(UI.errorModal);

Expand Down Expand Up @@ -37066,11 +37065,7 @@ var InfoEditor = function (_HashBrown$Views$Moda) {

var _this = _possibleConstructorReturn(this, _HashBrown$Views$Moda.call(this, params));

SettingsHelper.getSettings(_this.projectId, null, 'info').then(function (infoSettings) {
_this.model = infoSettings || {};

_this.fetch();
});
_this.fetch();
return _this;
}

Expand All @@ -37082,7 +37077,7 @@ var InfoEditor = function (_HashBrown$Views$Moda) {
InfoEditor.prototype.onClickSave = function onClickSave() {
var _this2 = this;

SettingsHelper.setSettings(this.projectId, null, 'info', this.model).then(function () {
SettingsHelper.setSettings(this.model.id, null, 'info', this.model.settings.info).then(function () {
_this2.close();

_this2.trigger('change', _this2.model);
Expand All @@ -37104,9 +37099,9 @@ var InfoEditor = function (_HashBrown$Views$Moda) {
}

return _.div({ class: 'widget-group' }, _.span({ class: 'widget widget--label' }, 'Name'), new HashBrown.Views.Widgets.Input({
value: this.model.name,
value: this.model.settings.info.name,
onChange: function onChange(newName) {
_this3.model.name = newName;
_this3.model.settings.info.name = newName;
}
}));
};
Expand Down Expand Up @@ -37168,11 +37163,7 @@ var SyncEditor = function (_HashBrown$Views$Moda) {

var _this = _possibleConstructorReturn(this, _HashBrown$Views$Moda.call(this, params));

SettingsHelper.getSettings(_this.projectId, '', 'sync').then(function (syncSettings) {
_this.model = syncSettings || {};

_this.fetch();
});
_this.fetch();
return _this;
}

Expand Down Expand Up @@ -37243,23 +37234,18 @@ var SyncEditor = function (_HashBrown$Views$Moda) {
};

/**
* Renders the project name editor
* Renders the project id editor
*
* @returns {HTMLElement} Element
*/


SyncEditor.prototype.renderProjectNameEditor = function renderProjectNameEditor() {
SyncEditor.prototype.renderProjectIdEditor = function renderProjectIdEditor() {
var _this5 = this;

if (!this.model.project) {
this.model.project = this.projectId;
}

return new HashBrown.Views.Widgets.Input({
name: 'name',
value: this.model.project || '',
placeholder: 'e.g. "' + ProjectHelper.currentProject + '"',
value: this.model.project,
onChange: function onChange(newValue) {
_this5.model.project = newValue;
}
Expand Down Expand Up @@ -37334,7 +37320,7 @@ var SyncEditor = function (_HashBrown$Views$Moda) {


SyncEditor.prototype.renderBody = function renderBody() {
return [this.renderField('Enabled', this.renderEnabledSwitch()), this.renderField('API URL', this.renderUrlEditor()), this.renderField('API Token', this.renderTokenEditor()), this.renderField('Project id', this.renderProjectNameEditor())];
return [this.renderField('Enabled', this.renderEnabledSwitch()), this.renderField('API URL', this.renderUrlEditor()), this.renderField('API Token', this.renderTokenEditor()), this.renderField('Project id', this.renderProjectIdEditor())];
};

return SyncEditor;
Expand Down Expand Up @@ -37383,11 +37369,7 @@ var LanguageEditor = function (_HashBrown$Views$Moda) {

var _this = _possibleConstructorReturn(this, _HashBrown$Views$Moda.call(this, params));

LanguageHelper.getLanguages(_this.projectId).then(function (selectedLanguages) {
_this.model = selectedLanguages || [];

_this.fetch();
});
_this.fetch();
return _this;
}

Expand All @@ -37399,7 +37381,7 @@ var LanguageEditor = function (_HashBrown$Views$Moda) {
LanguageEditor.prototype.onClickSave = function onClickSave() {
var _this2 = this;

LanguageHelper.setLanguages(this.projectId, this.model).then(function () {
LanguageHelper.setLanguages(this.model.id, this.model.settings.languages).then(function () {
_this2.close();

_this2.trigger('change');
Expand All @@ -37417,12 +37399,12 @@ var LanguageEditor = function (_HashBrown$Views$Moda) {
var _this3 = this;

return _.div({ class: 'widget-group' }, _.label({ class: 'widget widget--label' }, 'Selected languages'), new HashBrown.Views.Widgets.Dropdown({
value: this.model,
value: this.model.settings.languages,
useTypeAhead: true,
useMultiple: true,
options: LanguageHelper.getLanguageOptions(this.projectId),
options: LanguageHelper.getLanguageOptions(this.model.id),
onChange: function onChange(newValue) {
_this3.model = newValue;
_this3.model.settings.languages = newValue;
}
}).$element);
};
Expand Down Expand Up @@ -37485,7 +37467,6 @@ var BackupEditor = function (_HashBrown$Views$Moda) {
contentType: false,
success: function success(id) {
_this2.model = null;

_this2.fetch();

uploadModal.close();
Expand Down Expand Up @@ -37518,7 +37499,6 @@ var BackupEditor = function (_HashBrown$Views$Moda) {

RequestHelper.request('post', 'server/backups/' + this.model.id + '/new').then(function (data) {
_this3.model = null;

_this3.fetch();
}).catch(UI.errorModal);
};
Expand Down Expand Up @@ -37579,7 +37559,6 @@ var BackupEditor = function (_HashBrown$Views$Moda) {
modal.close();

_this5.model = null;

_this5.fetch();
}).catch(UI.errorModal);
});
Expand Down
5 changes: 0 additions & 5 deletions public/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,13 @@ $('.page--login__login').each(function() {

let apiPath = '/api/user/login?persist=true';
let inviteToken = $login.attr('data-invite-token');
let firstTime = $login.attr('data-first-time');

if(inviteToken) {
apiPath = '/api/user/activate';

data.inviteToken = inviteToken;
}

if(firstTime) {
apiPath = '/api/user/first';
}

apiCall('post', apiPath, data)
.then(function() {
let newLocation = getParam('path');
Expand Down
Loading

0 comments on commit ca0f532

Please sign in to comment.