From d492bac5872bf736c692a41aa3acd184b03ee789 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 11 Sep 2014 14:45:35 -0400 Subject: [PATCH] Remove the git commits widget from the admin dashboard --- .../admin/controllers/admin-commits.js.es6 | 7 -- .../javascripts/admin/models/github_commit.js | 41 ----------- .../admin/routes/admin-dashboard.js.es6 | 8 --- .../admin/templates/commits.js.handlebars | 21 ------ .../admin/templates/dashboard.js.handlebars | 69 +++++++++---------- .../stylesheets/common/admin/admin_base.scss | 9 ++- 6 files changed, 40 insertions(+), 115 deletions(-) delete mode 100644 app/assets/javascripts/admin/controllers/admin-commits.js.es6 delete mode 100644 app/assets/javascripts/admin/models/github_commit.js delete mode 100644 app/assets/javascripts/admin/templates/commits.js.handlebars diff --git a/app/assets/javascripts/admin/controllers/admin-commits.js.es6 b/app/assets/javascripts/admin/controllers/admin-commits.js.es6 deleted file mode 100644 index 1690f1291ff..00000000000 --- a/app/assets/javascripts/admin/controllers/admin-commits.js.es6 +++ /dev/null @@ -1,7 +0,0 @@ -export default Ember.ArrayController.extend({ - actions: { - goToGithub: function() { - window.open('https://github.com/discourse/discourse'); - } - } -}); diff --git a/app/assets/javascripts/admin/models/github_commit.js b/app/assets/javascripts/admin/models/github_commit.js deleted file mode 100644 index ff7ce6c6214..00000000000 --- a/app/assets/javascripts/admin/models/github_commit.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - A model for a git commit to the discourse repo, fetched from the github.com api. - - @class GithubCommit - @extends Discourse.Model - @namespace Discourse - @module Discourse -**/ -Discourse.GithubCommit = Discourse.Model.extend({ - gravatarUrl: function(){ - if( this.get('author') && this.get('author.gravatar_id') ){ - return("https://www.gravatar.com/avatar/" + this.get('author.gravatar_id') + ".png?s=38&r=pg&d=identicon"); - } else { - return "https://www.gravatar.com/avatar/b30fff48d257cdd17c4437afac19fd30.png?s=38&r=pg&d=identicon"; - } - }.property("commit"), - - commitUrl: function(){ - return("https://github.com/discourse/discourse/commit/" + this.get('sha')); - }.property("sha"), - - timeAgo: function() { - return moment(this.get('commit.committer.date')).relativeAge({format: 'medium', leaveAgo: true}); - }.property("commit.committer.date") -}); - -Discourse.GithubCommit.reopenClass({ - findAll: function() { - var result = Em.A(); - Discourse.ajax( "https://api.github.com/repos/discourse/discourse/commits?callback=callback", { - dataType: 'jsonp', - type: 'get', - data: { per_page: 40 } - }).then(function (response) { - _.each(response.data,function(commit) { - result.pushObject( Discourse.GithubCommit.create(commit) ); - }); - }); - return result; - } -}); diff --git a/app/assets/javascripts/admin/routes/admin-dashboard.js.es6 b/app/assets/javascripts/admin/routes/admin-dashboard.js.es6 index a83d2bb93d5..acf3b504bb0 100644 --- a/app/assets/javascripts/admin/routes/admin-dashboard.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-dashboard.js.es6 @@ -11,7 +11,6 @@ export default Discourse.Route.extend({ setupController: function(c) { this.fetchDashboardData(c); - this.fetchGithubCommits(c); }, fetchDashboardData: function(c) { @@ -45,13 +44,6 @@ export default Discourse.Route.extend({ c.set('problemsFetchedAt', new Date()); c.loadProblems(); } - }, - - fetchGithubCommits: function(c) { - if( !c.get('commitsCheckedAt') || moment().subtract(1, 'hour').toDate() > c.get('commitsCheckedAt') ) { - c.set('commitsCheckedAt', new Date()); - c.set('githubCommits', Discourse.GithubCommit.findAll()); - } } }); diff --git a/app/assets/javascripts/admin/templates/commits.js.handlebars b/app/assets/javascripts/admin/templates/commits.js.handlebars deleted file mode 100644 index 383b52c0c74..00000000000 --- a/app/assets/javascripts/admin/templates/commits.js.handlebars +++ /dev/null @@ -1,21 +0,0 @@ -
-
-

- - {{i18n admin.commits.latest_changes}} -

-
- -
diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index 4abbef9cbe7..c4f138d7c73 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -1,38 +1,4 @@
- {{#if foundProblems}} -
-
-
-

- {{i18n admin.dashboard.problems_found}} -

    - {{#each problem in problems}} -
  • {{{problem}}}
  • - {{/each}} -
-

-

- {{i18n admin.dashboard.last_checked}}: {{problemsTimestamp}} - -

-
-
-
- {{else}} - {{#if thereWereProblems}} -
-
 
-
-

- {{i18n admin.dashboard.no_problems}} - -

-
-
-
- {{/if}} - {{/if}} - {{#if Discourse.SiteSettings.version_checks}} {{partial 'admin/templates/version_checks'}} {{/if}} @@ -138,7 +104,40 @@
- {{ render 'admin/templates/commits' githubCommits }} + + {{#if foundProblems}} +
+
+
+

+ {{i18n admin.dashboard.problems_found}} +

    + {{#each problem in problems}} +
  • {{{problem}}}
  • + {{/each}} +
+

+

+ {{i18n admin.dashboard.last_checked}}: {{problemsTimestamp}} + +

+
+
+
+ {{else}} + {{#if thereWereProblems}} +
+
 
+
+

+ {{i18n admin.dashboard.no_problems}} + +

+
+
+
+ {{/if}} + {{/if}}
diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index c810d7a4905..a039c33b74f 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -591,6 +591,7 @@ section.details { .dashboard-left { float: left; + margin-top: 10px; width: 60%; } .dashboard-right { @@ -606,6 +607,8 @@ section.details { } .version-check { + margin-top: 10px; + .version-number { font-size: 18px; font-weight: bold; @@ -790,9 +793,9 @@ table.api-keys { } .referred-topic-title { - width: 410px; - @include medium-width { width: 360px; } - @include small-width { width: 320px; } + width: 355px; + @include medium-width { width: 305px; } + @include small-width { width: 265px; } } }