UX: better footer handling
This commit is contained in:
parent
c89064f7c0
commit
ec76be964e
|
@ -7,47 +7,38 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.SiteCustomization = Discourse.Model.extend({
|
||||
trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'mobile_stylesheet', 'mobile_header', 'override_default_style'],
|
||||
trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'override_default_style'],
|
||||
|
||||
description: function() {
|
||||
return "" + this.name + (this.enabled ? ' (*)' : '');
|
||||
}.property('selected', 'name'),
|
||||
|
||||
changed: function() {
|
||||
var self = this;
|
||||
|
||||
var _this = this;
|
||||
if(!this.originals) return false;
|
||||
if (!this.originals) { return false; }
|
||||
|
||||
var changed = _.some(this.trackedProperties,function(p) {
|
||||
return _this.originals[p] !== _this.get(p);
|
||||
var changed = _.some(this.trackedProperties, function (p) {
|
||||
return self.originals[p] !== self.get(p);
|
||||
});
|
||||
|
||||
if(changed){
|
||||
this.set('savingStatus','');
|
||||
}
|
||||
if (changed) { this.set('savingStatus', ''); }
|
||||
|
||||
return changed;
|
||||
|
||||
}.property('override_default_style', 'enabled', 'name', 'stylesheet', 'header', 'mobile_stylesheet', 'mobile_header', 'originals'),
|
||||
}.property('override_default_style', 'enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'originals'),
|
||||
|
||||
startTrackingChanges: function() {
|
||||
var _this = this;
|
||||
var self = this;
|
||||
var originals = {};
|
||||
_.each(this.trackedProperties,function(prop) {
|
||||
originals[prop] = _this.get(prop);
|
||||
return true;
|
||||
_.each(this.trackedProperties, function (prop) {
|
||||
originals[prop] = self.get(prop);
|
||||
});
|
||||
this.set('originals', originals);
|
||||
}.on('init'),
|
||||
|
||||
previewUrl: function() {
|
||||
return "/?preview-style=" + (this.get('key'));
|
||||
}.property('key'),
|
||||
|
||||
disableSave: function() {
|
||||
return !this.get('changed') || this.get('saving');
|
||||
}.property('changed'),
|
||||
|
||||
previewUrl: function() { return "/?preview-style=" + this.get('key'); }.property('key'),
|
||||
disableSave: function() { return !this.get('changed') || this.get('saving'); }.property('changed'),
|
||||
|
||||
save: function() {
|
||||
this.set('savingStatus', I18n.t('saving'));
|
||||
|
@ -57,8 +48,10 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
|||
enabled: this.enabled,
|
||||
stylesheet: this.stylesheet,
|
||||
header: this.header,
|
||||
footer: this.footer,
|
||||
mobile_stylesheet: this.mobile_stylesheet,
|
||||
mobile_header: this.mobile_header,
|
||||
mobile_footer: this.mobile_footer,
|
||||
override_default_style: this.override_default_style
|
||||
};
|
||||
|
||||
|
@ -75,23 +68,19 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
|||
siteCustomization.set('saving',false);
|
||||
siteCustomization.startTrackingChanges();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
if(!this.id) return;
|
||||
return Discourse.ajax("/admin/site_customizations/" + this.id, {
|
||||
type: 'DELETE'
|
||||
});
|
||||
if (!this.id) return;
|
||||
return Discourse.ajax("/admin/site_customizations/" + this.id, { type: 'DELETE' });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var SiteCustomizations = Ember.ArrayProxy.extend({
|
||||
selectedItemChanged: function() {
|
||||
var selected = this.get('selectedItem');
|
||||
_.each(this.get('content'),function(i) {
|
||||
return i.set('selected', selected === i);
|
||||
_.each(this.get('content'), function (i) {
|
||||
i.set('selected', selected === i);
|
||||
});
|
||||
}.observes('selectedItem')
|
||||
});
|
||||
|
|
|
@ -2,71 +2,58 @@
|
|||
<h3>{{i18n admin.customize.css_html.long_title}}</h3>
|
||||
<ul>
|
||||
{{#each model}}
|
||||
<li><a {{action "selectStyle" this}} {{bind-attr class="this.selected:active"}}>{{this.description}}</a></li>
|
||||
<li><a {{action "selectStyle" this}} {{bind-attr class="this.selected:active"}}>{{this.description}}</a></li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<button {{action "newCustomization"}} class='btn'><i class="fa fa-plus"></i>{{i18n admin.customize.new}}</button>
|
||||
<button {{action "newCustomization"}} class='btn'>
|
||||
{{fa-icon "plus"}}{{i18n admin.customize.new}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
{{#if selectedItem}}
|
||||
<div class='current-style'>
|
||||
{{#with selectedItem}}
|
||||
{{text-field class="style-name" value=name}}
|
||||
<div class='current-style'>
|
||||
{{#with selectedItem}}
|
||||
{{text-field class="style-name" value=name}}
|
||||
|
||||
<div class='admin-controls'>
|
||||
<ul class="nav nav-pills">
|
||||
<li>
|
||||
<a {{bind-attr class="view.stylesheetActive:active"}}{{action "selectStylesheet" href="true" target="view"}}>{{i18n admin.customize.css}}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a {{bind-attr class="view.headerActive:active"}}{{action "selectHeader" href="true" target="view"}}>{{i18n admin.customize.header}}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a {{bind-attr class="view.mobileStylesheetActive:active"}}{{action "selectMobileStylesheet" href="true" target="view"}}>{{i18n admin.customize.mobile_css}}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a {{bind-attr class="view.mobileHeaderActive:active"}}{{action "selectMobileHeader" href="true" target="view"}}>{{i18n admin.customize.mobile_header}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class='admin-controls'>
|
||||
<ul class="nav nav-pills">
|
||||
<li><a {{bind-attr class="view.stylesheetActive:active"}} {{action "selectStylesheet" target="view"}}>{{i18n admin.customize.css}}</a></li>
|
||||
<li><a {{bind-attr class="view.headerActive:active"}} {{action "selectHeader" target="view"}}>{{i18n admin.customize.header}}</a></li>
|
||||
<li><a {{bind-attr class="view.footerActive:active"}} {{action "selectFooter" target="view"}}>{{i18n admin.customize.footer}}</a></li>
|
||||
<li><a {{bind-attr class="view.mobileStylesheetActive:active"}} {{action "selectMobileStylesheet" target="view"}}>{{fa-icon "mobile"}} {{i18n admin.customize.css}}</a></li>
|
||||
<li><a {{bind-attr class="view.mobileHeaderActive:active"}} {{action "selectMobileHeader" target="view"}}>{{fa-icon "mobile"}} {{i18n admin.customize.header}}</a></li>
|
||||
<li><a {{bind-attr class="view.mobileFooterActive:active"}} {{action "selectMobileFooter" target="view"}}>{{fa-icon "mobile"}} {{i18n admin.customize.footer}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="admin-container">
|
||||
{{#if view.stylesheetActive}}{{aceEditor content=stylesheet mode="scss"}}{{/if}}
|
||||
{{#if view.headerActive}}{{aceEditor content=header mode="html"}}{{/if}}
|
||||
{{#if view.footerActive}}{{aceEditor content=footer mode="html"}}{{/if}}
|
||||
{{#if view.mobileStylesheetActive}}{{aceEditor content=mobile_stylesheet mode="scss"}}{{/if}}
|
||||
{{#if view.mobileHeaderActive}}{{aceEditor content=mobile_header mode="html"}}{{/if}}
|
||||
{{#if view.mobileFooterActive}}{{aceEditor content=mobile_footer mode="html"}}{{/if}}
|
||||
</div>
|
||||
{{/with}}
|
||||
<br>
|
||||
<div class='status-actions'>
|
||||
<span>{{i18n admin.customize.override_default}} {{view Ember.Checkbox checkedBinding="selectedItem.override_default_style"}}</span>
|
||||
<span>{{i18n admin.customize.enabled}} {{view Ember.Checkbox checkedBinding="selectedItem.enabled"}}</span>
|
||||
{{#unless selectedItem.changed}}
|
||||
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n admin.customize.explain_preview}}">{{i18n admin.customize.preview}}</a>
|
||||
|
|
||||
<a href="/?preview-style=" target='_blank' title="{{i18n admin.customize.explain_undo_preview}}">{{i18n admin.customize.undo_preview}}</a>
|
||||
|
|
||||
<a href="/?preview-style=default" target='_blank' title="{{i18n admin.customize.explain_rescue_preview}}">{{i18n admin.customize.rescue_preview}}</a><br>
|
||||
{{/unless}}
|
||||
</div>
|
||||
|
||||
<div class="admin-container">
|
||||
{{#if view.headerActive}}
|
||||
{{aceEditor content=header mode="html"}}
|
||||
{{/if}}
|
||||
{{#if view.stylesheetActive}}
|
||||
{{aceEditor content=stylesheet mode="scss"}}
|
||||
{{/if}}
|
||||
{{#if view.mobileHeaderActive}}
|
||||
{{aceEditor content=mobile_header mode="html"}}
|
||||
{{/if}}
|
||||
{{#if view.mobileStylesheetActive}}
|
||||
{{aceEditor content=mobile_stylesheet mode="scss"}}
|
||||
{{/if}}
|
||||
<div class='buttons'>
|
||||
<button {{action "save"}} {{bind-attr disabled="selectedItem.disableSave"}} class='btn'>{{i18n admin.customize.save}}</button>
|
||||
<span class='saving'>{{selectedItem.savingStatus}}</span>
|
||||
<a {{action "destroy"}} class='delete-link'>{{i18n admin.customize.delete}}</a>
|
||||
</div>
|
||||
{{/with}}
|
||||
<br>
|
||||
<div class='status-actions'>
|
||||
<span>{{i18n admin.customize.override_default}} {{view Ember.Checkbox checkedBinding="selectedItem.override_default_style"}}</span>
|
||||
<span>{{i18n admin.customize.enabled}} {{view Ember.Checkbox checkedBinding="selectedItem.enabled"}}</span>
|
||||
{{#unless selectedItem.changed}}
|
||||
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n admin.customize.explain_preview}}">{{i18n admin.customize.preview}}</a>
|
||||
|
|
||||
<a href="/?preview-style=" target='_blank' title="{{i18n admin.customize.explain_undo_preview}}">{{i18n admin.customize.undo_preview}}</a>
|
||||
|
|
||||
<a href="/?preview-style=default" target='_blank' title="{{i18n admin.customize.explain_rescue_preview}}">{{i18n admin.customize.rescue_preview}}</a><br>
|
||||
{{/unless}}
|
||||
</div>
|
||||
|
||||
<div class='buttons'>
|
||||
<button {{action "save"}} {{bind-attr disabled="selectedItem.disableSave"}} class='btn'>{{i18n admin.customize.save}}</button>
|
||||
<span class='saving'>{{selectedItem.savingStatus}}</span>
|
||||
<a {{action "destroy"}} class='delete-link'>{{i18n admin.customize.delete}}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="about">{{i18n admin.customize.about}}</p>
|
||||
{{/if}}
|
||||
<div class='clearfix'></div>
|
||||
|
|
|
@ -12,15 +12,20 @@ Discourse.AdminCustomizeView = Discourse.View.extend({
|
|||
templateName: 'admin/templates/customize',
|
||||
classNames: ['customize'],
|
||||
selected: 'stylesheet',
|
||||
|
||||
headerActive: Em.computed.equal('selected', 'header'),
|
||||
footerActive: Em.computed.equal('selected', 'footer'),
|
||||
stylesheetActive: Em.computed.equal('selected', 'stylesheet'),
|
||||
mobileHeaderActive: Em.computed.equal('selected', 'mobileHeader'),
|
||||
mobileFooterActive: Em.computed.equal('selected', 'mobileFooter'),
|
||||
mobileStylesheetActive: Em.computed.equal('selected', 'mobileStylesheet'),
|
||||
|
||||
actions: {
|
||||
selectHeader: function() { this.set('selected', 'header'); },
|
||||
selectFooter: function() { this.set('selected', 'footer'); },
|
||||
selectStylesheet: function() { this.set('selected', 'stylesheet'); },
|
||||
selectMobileHeader: function() { this.set('selected', 'mobileHeader'); },
|
||||
selectMobileFooter: function() { this.set('selected', 'mobileFooter'); },
|
||||
selectMobileStylesheet: function() { this.set('selected', 'mobileStylesheet'); }
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object';
|
|||
import TopPeriod from 'discourse/models/top-period';
|
||||
|
||||
export default ObjectController.extend({
|
||||
needs: ['navigation/category'],
|
||||
needs: ['navigation/category', 'discovery/topics'],
|
||||
loading: false,
|
||||
loadingSpinner: false,
|
||||
scheduledSpinner: null,
|
||||
|
@ -10,6 +10,8 @@ export default ObjectController.extend({
|
|||
category: Em.computed.alias('controllers.navigation/category.category'),
|
||||
noSubcategories: Em.computed.alias('controllers.navigation/category.noSubcategories'),
|
||||
|
||||
loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"),
|
||||
|
||||
showMoreUrl: function(period) {
|
||||
var url = '', category = this.get('category');
|
||||
if (category) {
|
||||
|
|
|
@ -3,6 +3,7 @@ export default Ember.ArrayController.extend({
|
|||
needs: ['user-notifications'],
|
||||
canLoadMore: true,
|
||||
loading: false,
|
||||
|
||||
showDismissButton: function() {
|
||||
return this.get('user').total_unread_notifications > 0;
|
||||
}.property('user'),
|
||||
|
@ -26,7 +27,7 @@ export default Ember.ArrayController.extend({
|
|||
var notifications = result.get('content');
|
||||
self.pushObjects(notifications);
|
||||
// Stop trying if it's the end
|
||||
if (notifications && notifications.length === 0) {
|
||||
if (notifications && (notifications.length === 0 || notifications.length < 60)) {
|
||||
self.set('canLoadMore', false);
|
||||
}
|
||||
}).catch(function(error) {
|
||||
|
|
|
@ -2,6 +2,7 @@ import ObjectController from 'discourse/controllers/object';
|
|||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
|
||||
export default ObjectController.extend(CanCheckEmails, {
|
||||
needs: ['user-notifications', 'user_topics_list'],
|
||||
|
||||
viewingSelf: function() {
|
||||
return this.get('content.username') === Discourse.User.currentProp('username');
|
||||
|
@ -32,15 +33,31 @@ export default ObjectController.extend(CanCheckEmails, {
|
|||
(this.get('userActionType') === Discourse.UserAction.TYPES.messages_received);
|
||||
}.property('userActionType'),
|
||||
|
||||
/**
|
||||
Can the currently logged in user invite users to the site
|
||||
|
||||
@property canInviteToForum
|
||||
**/
|
||||
canInviteToForum: function() {
|
||||
return Discourse.User.currentProp('can_invite_to_forum');
|
||||
}.property(),
|
||||
|
||||
loadedAllItems: function() {
|
||||
switch (this.get("datasource")) {
|
||||
case "badges": { return true; }
|
||||
case "notifications": { return !this.get("controllers.user-notifications.canLoadMore"); }
|
||||
case "topic_list": { return !this.get("controllers.user_topics_list.canLoadMore"); }
|
||||
case "stream": {
|
||||
if (this.get("userActionType")) {
|
||||
var stat = _.find(this.get("stats"), { action_type: this.get("userActionType") });
|
||||
return stat && stat.count <= this.get("stream.itemsLoaded");
|
||||
} else {
|
||||
return this.get("statsCountNonPM") <= this.get("stream.itemsLoaded");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}.property("datasource",
|
||||
"userActionType", "stats", "stream.itemsLoaded",
|
||||
"controllers.user_topics_list.canLoadMore",
|
||||
"controllers.user-notifications.canLoadMore"),
|
||||
|
||||
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
||||
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
||||
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread')
|
||||
|
|
|
@ -31,6 +31,8 @@ function finderFor(filter, params) {
|
|||
}
|
||||
|
||||
Discourse.TopicList = Discourse.Model.extend({
|
||||
canLoadMore: Em.computed.notEmpty("more_topics_url"),
|
||||
|
||||
forEachNew: function(topics, callback) {
|
||||
var topicIds = [];
|
||||
_.each(this.get('topics'),function(topic) {
|
||||
|
@ -68,7 +70,6 @@ Discourse.TopicList = Discourse.Model.extend({
|
|||
|
||||
var moreUrl = this.get('more_topics_url');
|
||||
if (moreUrl) {
|
||||
|
||||
var self = this;
|
||||
this.set('loadingMore', true);
|
||||
|
||||
|
@ -84,7 +85,11 @@ Discourse.TopicList = Discourse.Model.extend({
|
|||
topics.pushObject(t);
|
||||
});
|
||||
|
||||
self.setProperties({ loadingMore: false, more_topics_url: result.topic_list.more_topics_url });
|
||||
self.setProperties({
|
||||
loadingMore: false,
|
||||
more_topics_url: result.topic_list.more_topics_url
|
||||
});
|
||||
|
||||
Discourse.Session.currentProp('topicList', self);
|
||||
return self.get('more_topics_url');
|
||||
}
|
||||
|
|
|
@ -40,14 +40,12 @@ export default function(filter, extras) {
|
|||
},
|
||||
|
||||
setupController: function(controller, model, trans) {
|
||||
|
||||
if (trans) {
|
||||
controller.setProperties(Em.getProperties(trans, _.keys(queryParams).map(function(v){
|
||||
return 'queryParams.' + v;
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
var periods = this.controllerFor('discovery').get('periods'),
|
||||
periodId = model.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : '');
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
this.controllerFor('user').set('indexStream', false);
|
||||
this.controllerFor('user').setProperties({
|
||||
indexStream: false,
|
||||
datasource: "badges",
|
||||
});
|
||||
|
||||
if (this.controllerFor('user_activity').get('content')) {
|
||||
this.controllerFor('user_activity').set('userActionType', -1);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,15 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
this.controllerFor('user').set('indexStream', false);
|
||||
this.controllerFor('user').setProperties({
|
||||
indexStream: false,
|
||||
datasource: "notifications"
|
||||
});
|
||||
|
||||
if (this.controllerFor('user_activity').get('content')) {
|
||||
this.controllerFor('user_activity').set('userActionType', -1);
|
||||
}
|
||||
|
||||
controller.set('model', model);
|
||||
controller.set('user', this.modelFor('user'));
|
||||
},
|
||||
|
|
|
@ -23,7 +23,10 @@ Discourse.UserActivityStreamRoute = Discourse.Route.extend({
|
|||
controller.set('model', model);
|
||||
this.controllerFor('user_activity').set('userActionType', this.get('userActionType'));
|
||||
|
||||
this.controllerFor('user').set('indexStream', !this.get('userActionType'));
|
||||
this.controllerFor('user').setProperties({
|
||||
indexStream: !this.get('userActionType'),
|
||||
datasource: "stream"
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -4,7 +4,10 @@ Discourse.UserTopicListRoute = Discourse.Route.extend({
|
|||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
this.controllerFor('user').set('indexStream', false);
|
||||
this.controllerFor('user').setProperties({
|
||||
indexStream: false,
|
||||
datasource: "topic_list"
|
||||
});
|
||||
this.controllerFor('user-activity').set('userActionType', this.get('userActionType'));
|
||||
this.controllerFor('user_topics_list').setProperties({
|
||||
model: model,
|
||||
|
@ -30,7 +33,8 @@ function createPMRoute(viewName, path) {
|
|||
});
|
||||
this.controllerFor('user').setProperties({
|
||||
pmView: viewName,
|
||||
indexStream: false
|
||||
indexStream: false,
|
||||
datasource: "topic_list"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -62,3 +62,7 @@
|
|||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
|
|
|
@ -19,3 +19,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
</div>
|
||||
{{#if canLoadMore}}
|
||||
{{loading-spinner}}
|
||||
{{else}}
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#unless userBadgesLoaded}}
|
||||
|
|
|
@ -10,25 +10,28 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div {{bind-attr class="loadingSpinner::hidden"}}>
|
||||
{{#if loadingSpinner}}
|
||||
{{loading-spinner}}
|
||||
</div>
|
||||
|
||||
|
||||
<div {{bind-attr class=":container :list-container loadingSpinner:hidden"}}>
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id='header-list-area'>
|
||||
{{outlet header-list-container}}
|
||||
{{else}}
|
||||
<div {{bind-attr class=":container :list-container loadingSpinner:hidden"}}>
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id='header-list-area'>
|
||||
{{outlet header-list-container}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id='list-area'>
|
||||
{{outlet list-container}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id='list-area'>
|
||||
{{outlet list-container}}
|
||||
</div>
|
||||
{{#if loadedAllItems}}
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -7,3 +7,7 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
</a>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if details.can_edit}}
|
||||
<a href='#' {{action "editTopic"}} class='edit-topic' title='{{i18n edit}}'>{{fa-icon pencil}}</a>
|
||||
{{/if}}
|
||||
|
@ -112,6 +111,9 @@
|
|||
<h3>{{{view.browseMoreMessage}}}</h3>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
@ -119,7 +121,6 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
{{#if hasError}}
|
||||
<div class='container'>
|
||||
|
@ -133,11 +134,11 @@
|
|||
<button {{action "showLogin"}} class='btn btn-primary topic-retry'>{{fa-icon user}} {{i18n log_in}}</button>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
<button class="btn btn-primary topic-retry" {{action "retryLoading"}}><i class="fa fa-refresh"></i> {{i18n errors.buttons.again}}</button>
|
||||
<button class="btn btn-primary topic-retry" {{action "retryLoading"}}>{{fa-icon "refresh"}} {{i18n errors.buttons.again}}</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if retrying}}
|
||||
{{loading-spinner}}
|
||||
{{loading-spinner}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if showDismissButton}}
|
||||
<div class='notification-buttons'>
|
||||
<button title="{{i18n user.dismiss_notifications_tooltip}}" id='dismiss-notifications-top' class='btn notifications-read' {{action "resetNew"}}>{{i18n user.dismiss_notifications}}</button>
|
||||
|
@ -24,12 +25,12 @@
|
|||
|
||||
{{#if loading}}
|
||||
{{loading-spinner}}
|
||||
{{else}}
|
||||
{{#unless canLoadMore}}
|
||||
{{#if showDismissButton}}
|
||||
<div class='notification-buttons'>
|
||||
<button title="{{i18n user.dismiss_notifications_tooltip}}" id='dismiss-notifications' class='btn notifications-read' {{action "resetNew"}}>{{i18n user.dismiss_notifications}}</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{#unless canLoadMore}}
|
||||
<div class='end-of-stream'></div>
|
||||
{{#if showDismissButton}}
|
||||
<div class='notification-buttons'>
|
||||
<button title="{{i18n user.dismiss_notifications_tooltip}}" id='dismiss-notifications' class='btn notifications-read' {{action "resetNew"}}>{{i18n user.dismiss_notifications}}</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
{{/grouped-each}}
|
||||
</div>
|
||||
{{/grouped-each}}
|
||||
|
||||
{{#if loading}}
|
||||
{{loading-spinner}}
|
||||
{{/if}}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
{{#unless loading}}
|
||||
<div class="container">
|
||||
|
||||
<section class='user-main'>
|
||||
<section {{bind-attr class="collapsedInfo :about profileBackground:has-background:no-background"}}>
|
||||
<div class='staff-counters'>
|
||||
|
@ -33,80 +32,54 @@
|
|||
<div><span class="warnings-received">{{number_of_warnings}}</span> {{i18n user.staff_counters.warnings_received}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class='profile-image' {{bind-attr style="profileBackground"}}>
|
||||
|
||||
</div>
|
||||
<div class='profile-image' {{bind-attr style="profileBackground"}}></div>
|
||||
<div class='details'>
|
||||
<div class='primary'>
|
||||
|
||||
{{bound-avatar model "huge"}}
|
||||
|
||||
<section class='controls'>
|
||||
|
||||
<ul>
|
||||
|
||||
{{#if can_send_private_message_to_user}}
|
||||
<li>
|
||||
<a class='btn btn-primary right' {{action "composePrivateMessage"}}>
|
||||
<i class='fa fa-envelope'></i>
|
||||
{{i18n user.private_message}}
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if viewingSelf}}
|
||||
<li>
|
||||
<a {{action "logout"}} class='btn btn-danger right'><i class='fa fa-sign-out'></i>{{i18n user.log_out}}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if currentUser.staff}}
|
||||
<li>
|
||||
<a {{bind-attr href="adminPath"}} class='btn right'><i class="fa fa-wrench"></i>{{i18n admin.user.show_admin_profile}}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if can_edit}}
|
||||
<li>
|
||||
{{#link-to 'preferences' class="btn right"}}<i class='fa fa-cog'></i>{{i18n user.preferences}}{{/link-to}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if canInviteToForum}}
|
||||
<li>
|
||||
{{#link-to 'user.invited' class="btn right"}}<i class='fa fa-envelope-o'></i>{{i18n user.invited.title}}{{/link-to}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
{{#if can_send_private_message_to_user}}
|
||||
<li>
|
||||
<a class='btn btn-primary right' {{action "composePrivateMessage"}}>
|
||||
{{fa-icon "envelope"}}
|
||||
{{i18n user.private_message}}
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if viewingSelf}}
|
||||
<li><a {{action "logout"}} class='btn btn-danger right'>{{fa-icon "sign-out"}}{{i18n user.log_out}}</a></li>
|
||||
{{/if}}
|
||||
{{#if currentUser.staff}}
|
||||
<li><a {{bind-attr href="adminPath"}} class='btn right'>{{fa-icon "wrench"}}{{i18n admin.user.show_admin_profile}}</a></li>
|
||||
{{/if}}
|
||||
{{#if can_edit}}
|
||||
<li>{{#link-to 'preferences' class="btn right"}}{{fa-icon "cog"}}{{i18n user.preferences}}{{/link-to}}</li>
|
||||
{{/if}}
|
||||
{{#if canInviteToForum}}
|
||||
<li>{{#link-to 'user.invited' class="btn right"}}{{fa-icon "envelope-o"}}{{i18n user.invited.title}}{{/link-to}}</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div class="primary-textual">
|
||||
<h1>{{username}} {{{statusIcon}}}</h1>
|
||||
<h2>{{name}}</h2>
|
||||
<h3>
|
||||
|
||||
{{#if location}}
|
||||
<i class="fa fa-map-marker"></i>
|
||||
{{location}}
|
||||
{{/if}}
|
||||
|
||||
{{#if location}}{{fa-icon "map-maker"}}{{location}}{{/if}}
|
||||
{{#if websiteName}}
|
||||
<i class="fa fa-globe"></i>
|
||||
{{fa-icon "globe"}}
|
||||
{{#if linkWebsite}}
|
||||
<a {{bind-attr href="website"}} rel="nofollow" target="_blank">{{websiteName}}</a>
|
||||
{{else}}
|
||||
<span {{bind-attr title="website"}}>{{websiteName}}</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
</h3>
|
||||
|
||||
<div class='bio'>
|
||||
{{#if isSuspended}}
|
||||
<div class='suspended'>
|
||||
<i class='fa fa-ban'></i>
|
||||
{{fa-icon "ban"}}
|
||||
<b>{{i18n user.suspended_notice date="suspendedTillDate"}}</b><br/>
|
||||
<b>{{i18n user.suspended_reason}}</b> {{suspend_reason}}
|
||||
</div>
|
||||
|
@ -116,17 +89,13 @@
|
|||
|
||||
{{plugin-outlet "user-profile-primary"}}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style='clear: both'></div>
|
||||
<div style='clear: both'></div>
|
||||
</div>
|
||||
|
||||
<div class='secondary'>
|
||||
<dl>
|
||||
|
||||
{{#if created_at}}
|
||||
<dt>{{i18n user.created}}</dt><dd>{{bound-date created_at}}</dd>
|
||||
{{/if}}
|
||||
|
@ -162,67 +131,72 @@
|
|||
{{plugin-outlet "user-profile-secondary"}}
|
||||
</div>
|
||||
</section>
|
||||
<section class='user-navigation'>
|
||||
|
||||
<ul class='action-list nav-stacked'>
|
||||
{{activity-filter count=statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}}
|
||||
{{#each stat in statsExcludingPms}}
|
||||
{{activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}}
|
||||
{{/each}}
|
||||
{{#if showBadges}}
|
||||
{{#link-to 'user.badges' tagName="li"}}
|
||||
{{#link-to 'user.badges'}}
|
||||
<i class='glyph fa fa-certificate'></i>
|
||||
{{i18n badges.title}}
|
||||
<span class='count'>({{badge_count}})</span>
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
{{/link-to}}
|
||||
{{/if}}
|
||||
{{#if canSeeNotificationHistory}}
|
||||
{{#link-to 'user.notifications' tagName="li"}}
|
||||
{{#link-to 'user.notifications'}}
|
||||
<i class='glyph fa fa-comment'></i>
|
||||
{{i18n user.notifications}}
|
||||
<span class='count'>({{notification_count}})</span>
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
{{/link-to}}
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
||||
{{#if canSeePrivateMessages}}
|
||||
<h3><i class='fa fa-envelope'></i> {{i18n user.private_messages}}</h3>
|
||||
<section class='user-navigation'>
|
||||
<ul class='action-list nav-stacked'>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.index' model}}
|
||||
{{i18n user.messages.all}}
|
||||
{{#if hasPMs}}<span class='count'>({{private_messages_stats.all}})</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{activity-filter count=statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}}
|
||||
{{#each stat in statsExcludingPms}}
|
||||
{{activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}}
|
||||
{{/each}}
|
||||
{{#if showBadges}}
|
||||
{{#link-to 'user.badges' tagName="li"}}
|
||||
{{#link-to 'user.badges'}}
|
||||
<i class='glyph fa fa-certificate'></i>
|
||||
{{i18n badges.title}}
|
||||
<span class='count'>({{badge_count}})</span>
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesMineActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.mine' model}}
|
||||
{{i18n user.messages.mine}}
|
||||
{{#if hasStartedPMs}}<span class='count'>({{private_messages_stats.mine}})</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/if}}
|
||||
{{#if canSeeNotificationHistory}}
|
||||
{{#link-to 'user.notifications' tagName="li"}}
|
||||
{{#link-to 'user.notifications'}}
|
||||
<i class='glyph fa fa-comment'></i>
|
||||
{{i18n user.notifications}}
|
||||
<span class='count'>({{notification_count}})</span>
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesUnreadActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.unread' model}}
|
||||
{{i18n user.messages.unread}}
|
||||
{{#if hasUnreadPMs}}<span class='badge-notification unread-private-messages'>{{private_messages_stats.unread}}</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
{{#if canSeePrivateMessages}}
|
||||
<h3>{{fa-icon "envelope"}} {{i18n user.private_messages}}</h3>
|
||||
<ul class='action-list nav-stacked'>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.index' model}}
|
||||
{{i18n user.messages.all}}
|
||||
{{#if hasPMs}}<span class='count'>({{private_messages_stats.all}})</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
</li>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesMineActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.mine' model}}
|
||||
{{i18n user.messages.mine}}
|
||||
{{#if hasStartedPMs}}<span class='count'>({{private_messages_stats.mine}})</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
</li>
|
||||
<li {{bind-attr class=":noGlyph privateMessagesUnreadActive:active"}}>
|
||||
{{#link-to 'userPrivateMessages.unread' model}}
|
||||
{{i18n user.messages.unread}}
|
||||
{{#if hasUnreadPMs}}<span class='badge-notification unread-private-messages'>{{private_messages_stats.unread}}</span>{{/if}}
|
||||
<span class='fa fa-chevron-right'></span>
|
||||
{{/link-to}}
|
||||
</li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
||||
{{outlet userOutlet}}
|
||||
|
||||
</section>
|
||||
|
||||
{{outlet userOutlet}}
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
{{#if loadedAllItems}}
|
||||
<div class="container">
|
||||
{{custom-html "footer"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{/unless}}
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.end-of-stream {
|
||||
border: 3px solid $primary;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.notification-buttons {
|
||||
margin: 10px 0;
|
||||
text-align: right;
|
||||
|
|
|
@ -408,9 +408,6 @@
|
|||
|
||||
.user-stream {
|
||||
padding: 0 10px;
|
||||
.end-of-stream {
|
||||
width: auto;
|
||||
}
|
||||
.excerpt {
|
||||
margin: 5px 0;
|
||||
font-size: 13px;
|
||||
|
|
|
@ -51,7 +51,11 @@ class Admin::SiteCustomizationsController < Admin::AdminController
|
|||
private
|
||||
|
||||
def site_customization_params
|
||||
params.require(:site_customization).permit(:name, :stylesheet, :header, :mobile_stylesheet, :mobile_header, :position, :enabled, :key, :override_default_style, :stylesheet_baked)
|
||||
params.require(:site_customization)
|
||||
.permit(:name, :stylesheet, :header, :footer,
|
||||
:mobile_stylesheet, :mobile_header, :mobile_footer,
|
||||
:position, :enabled, :key, :override_default_style,
|
||||
:stylesheet_baked)
|
||||
end
|
||||
|
||||
def log_site_customization_change(old_record, new_params)
|
||||
|
|
|
@ -261,7 +261,7 @@ class ApplicationController < ActionController::Base
|
|||
def custom_html_json
|
||||
data = {
|
||||
top: SiteText.text_for(:top),
|
||||
bottom: SiteText.text_for(:bottom)
|
||||
footer: SiteCustomization.custom_footer(session[:preview_style])
|
||||
}
|
||||
|
||||
if DiscoursePluginRegistry.custom_html
|
||||
|
|
|
@ -21,9 +21,7 @@ class NotificationsController < ApplicationController
|
|||
params[:before] ||= 1.day.from_now
|
||||
|
||||
user = current_user
|
||||
if params[:user]
|
||||
user = User.find_by_username(params[:user].to_s)
|
||||
end
|
||||
user = User.find_by_username(params[:user].to_s) if params[:user]
|
||||
|
||||
unless guardian.can_see_notifications?(user)
|
||||
return render json: {errors: [I18n.t('js.errors.reasons.forbidden')]}, status: 403
|
||||
|
|
|
@ -17,7 +17,6 @@ class SiteCustomization < ActiveRecord::Base
|
|||
DiscourseSassCompiler.compile(scss, 'custom')
|
||||
rescue => e
|
||||
puts e.backtrace.join("\n") unless Sass::SyntaxError === e
|
||||
|
||||
raise e
|
||||
end
|
||||
|
||||
|
@ -34,29 +33,21 @@ class SiteCustomization < ActiveRecord::Base
|
|||
end
|
||||
|
||||
after_save do
|
||||
if stylesheet_changed?
|
||||
File.delete(stylesheet_fullpath) if File.exists?(stylesheet_fullpath)
|
||||
end
|
||||
if mobile_stylesheet_changed?
|
||||
File.delete(stylesheet_fullpath(:mobile)) if File.exists?(stylesheet_fullpath(:mobile))
|
||||
end
|
||||
File.delete(stylesheet_fullpath) if File.exists?(stylesheet_fullpath) && stylesheet_changed?
|
||||
File.delete(stylesheet_fullpath(:mobile)) if File.exists?(stylesheet_fullpath(:mobile)) && mobile_stylesheet_changed?
|
||||
remove_from_cache!
|
||||
if stylesheet_changed? or mobile_stylesheet_changed?
|
||||
if stylesheet_changed? || mobile_stylesheet_changed?
|
||||
ensure_stylesheets_on_disk!
|
||||
# TODO: this is broken now because there's mobile stuff too
|
||||
MessageBus.publish "/file-change/#{key}", stylesheet_hash
|
||||
end
|
||||
MessageBus.publish "/header-change/#{key}", header if header_changed?
|
||||
|
||||
MessageBus.publish "/footer-change/#{key}", footer if footer_changed?
|
||||
end
|
||||
|
||||
after_destroy do
|
||||
if File.exists?(stylesheet_fullpath)
|
||||
File.delete stylesheet_fullpath
|
||||
end
|
||||
if File.exists?(stylesheet_fullpath(:mobile))
|
||||
File.delete stylesheet_fullpath(:mobile)
|
||||
end
|
||||
File.delete(stylesheet_fullpath) if File.exists?(stylesheet_fullpath)
|
||||
File.delete(stylesheet_fullpath(:mobile)) if File.exists?(stylesheet_fullpath(:mobile))
|
||||
self.remove_from_cache!
|
||||
end
|
||||
|
||||
|
@ -97,6 +88,16 @@ class SiteCustomization < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.custom_footer(preview_style, target=:dekstop)
|
||||
preview_style ||= enabled_style_key
|
||||
style = lookup_style(preview_style)
|
||||
if style && ((target != :mobile && style.footer) || (target == :mobile && style.mobile_footer))
|
||||
target == :mobile ? style.mobile_footer.html_safe : style.footer.html_safe
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def self.override_default_style(preview_style)
|
||||
preview_style ||= enabled_style_key
|
||||
style = lookup_style(preview_style)
|
||||
|
|
|
@ -80,7 +80,9 @@
|
|||
|
||||
<%= yield :data %>
|
||||
|
||||
<footer id='bottom'><%= raw SiteText.text_for(:bottom) %></footer>
|
||||
<footer id='bottom'>
|
||||
<%= raw SiteText.text_for(:bottom) %>
|
||||
</footer>
|
||||
|
||||
<%= render :partial => "common/discourse_javascript" %>
|
||||
|
||||
|
|
|
@ -1682,10 +1682,9 @@ en:
|
|||
customize:
|
||||
title: "Customize"
|
||||
long_title: "Site Customizations"
|
||||
css: "CSS"
|
||||
header: "Header"
|
||||
css: "Stylesheet"
|
||||
mobile_header: "Mobile Header"
|
||||
mobile_css: "Mobile Stylesheet"
|
||||
footer: "Footer"
|
||||
override_default: "Do not include standard style sheet"
|
||||
enabled: "Enabled?"
|
||||
preview: "preview"
|
||||
|
|
|
@ -634,7 +634,7 @@ en:
|
|||
description: "HTML that will be added at the top of every page (after the header, before the navigation or the topic title)."
|
||||
bottom:
|
||||
title: "Bottom of the pages"
|
||||
description: "HTML that will be added at the bottom of every page."
|
||||
description: "HTML that will be added before the </body> tag."
|
||||
|
||||
site_settings:
|
||||
censored_words: "Words that will be automatically replaced with ■■■■"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddFooterToSiteCustomization < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :site_customizations, :footer, :text
|
||||
add_column :site_customizations, :mobile_footer, :text
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue