From 92026a09a06f40dde92810d9bde75f26d9c14746 Mon Sep 17 00:00:00 2001 From: Wedge Date: Wed, 4 May 2016 18:49:30 +0300 Subject: [PATCH] Revamp interface --- .../build_lists/build_lists_controller.js.erb | 49 ++---- .../controllers/rosa_abf_controller.js | 20 ++- app/controllers/home_controller.rb | 2 +- .../projects/build_lists_controller.rb | 1 + .../projects/projects_controller.rb | 1 + app/views/layouts/application.html.slim | 7 +- app/views/layouts/menu/_new_top.html.slim | 5 - .../projects/build_lists/_buttons.html.slim | 112 +++++++------- .../projects/build_lists/index.html.slim | 80 ++++++++++ app/views/projects/build_lists/show.html.slim | 31 ++-- .../projects/projects/dashboard.html.slim | 146 ------------------ app/views/projects/projects/index.html.slim | 29 ++++ .../projects/projects/index.json.jbuilder | 1 + config/locales/menu.en.yml | 2 + config/routes.rb | 2 - 15 files changed, 223 insertions(+), 265 deletions(-) create mode 100644 app/views/projects/build_lists/index.html.slim delete mode 100644 app/views/projects/projects/dashboard.html.slim create mode 100644 app/views/projects/projects/index.html.slim diff --git a/app/assets/javascripts/angularjs/build_lists/build_lists_controller.js.erb b/app/assets/javascripts/angularjs/build_lists/build_lists_controller.js.erb index cc9ff3899..a68b00671 100644 --- a/app/assets/javascripts/angularjs/build_lists/build_lists_controller.js.erb +++ b/app/assets/javascripts/angularjs/build_lists/build_lists_controller.js.erb @@ -1,11 +1,11 @@ -RosaABF.controller('BuildListsController', ['$scope', 'BuildListsService', '$location', '$interval', '$uibModal', 'ProjectSelectService', -function($scope, BuildListsService, $location, $interval, $uibModal, ProjectSelectService) { +RosaABF.controller('BuildListsController', ['$scope', 'BuildListsService', '$location', '$interval', '$uibModal', +function($scope, BuildListsService, $location, $interval, $uibModal) { $scope.params = null; $scope.build_lists = []; $scope.isRequest = false; // Disable 'Search' button $scope.opened = {}; - $scope.ProjectSelectService = ProjectSelectService; + var selectedProject = ""; var refresh, is_autoreload_on; var default_filters = {page: '1', per_page: '25', 'ownership': 'owned'}; @@ -23,17 +23,20 @@ function($scope, BuildListsService, $location, $interval, $uibModal, ProjectSele } } - $scope.getBuildLists = function() { + $scope.getBuildLists = function(project) { if ($scope.isRequest) { return; } - ProjectSelectService.disable_bl = true; - $scope.isRequest = true; - - if(ProjectSelectService.project) { - var project = ProjectSelectService.project; + if(selectedProject) { + project = selectedProject; } + else { + selectedProject = project; + } + + $scope.widgetTitle = project; + $scope.isRequest = true; var filter = Object.assign(Object.create(null), default_filters, $location.search()); var fixed_filter = Object.create(null); @@ -66,15 +69,9 @@ function($scope, BuildListsService, $location, $interval, $uibModal, ProjectSele $location.search(Object.assign(filter, res.filter)); $scope.per_page = filter.per_page; $scope.isRequest = false; - ProjectSelectService.disable_bl = false; - ProjectSelectService.load_project_info = ProjectSelectService.project; }); } - $scope.clearProject = function() { - ProjectSelectService.project = ""; - } - $scope.showRelated = function(build_list) { build_list.relatedHidden = false; $scope.opened[build_list.id] = true; @@ -129,28 +126,6 @@ function($scope, BuildListsService, $location, $interval, $uibModal, ProjectSele } $scope.setAutoreload(true); - - var project_hash = $location.search(); - if(project_hash['project']) { - ProjectSelectService.project = project_hash['project']; - $location.search('project', null); - } - - $scope.$watch(function() { - return ProjectSelectService.project; - }, function() { - var turn_back_on = is_autoreload_on; - if(ProjectSelectService.project) { - $scope.widget_title = " | " + ProjectSelectService.project; - } - else { - $scope.widget_title = ""; - } - $scope.setAutoreload(false); - $scope.getBuildLists(); - $scope.setAutoreload(turn_back_on); - }); - }]); RosaABF.controller('FiltersInstanceController', ['$scope', '$uibModalInstance', 'params', diff --git a/app/assets/javascripts/angularjs/controllers/rosa_abf_controller.js b/app/assets/javascripts/angularjs/controllers/rosa_abf_controller.js index da2b844f1..716b6e375 100644 --- a/app/assets/javascripts/angularjs/controllers/rosa_abf_controller.js +++ b/app/assets/javascripts/angularjs/controllers/rosa_abf_controller.js @@ -7,6 +7,24 @@ RosaABF.controller('RosaABFController', ['$scope', 'LocalesHelper', 'SoundNotifi //moment.locale(locale); SoundNotificationsHelper.enabled(sound_notifications); $timeout(function() { $scope.hideAlerts = true; }, 5000); - console.log($scope); } + var mobileView = 992; + + $scope.getWidth = function() { + return window.innerWidth; + }; + + $scope.$watch($scope.getWidth, function(newValue, oldValue) { + if (newValue >= mobileView) { + $scope.toggle = true; + } + else { + $scope.toggle = false; + } + }); + + $scope.toggleSidebar = function() { + $scope.toggle = !$scope.toggle; + }; + }]); diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index fa774eb35..44b565b45 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,7 +3,7 @@ class HomeController < ApplicationController skip_after_action :verify_authorized def index - redirect_to projects_dashboard_path + redirect_to projects_path end def activity(is_my_activity = false) diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index be81d6756..89f824681 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -16,6 +16,7 @@ class Projects::BuildListsController < Projects::BaseController params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter] respond_to do |format| + format.html format.json do @filter = BuildList::Filter.new(@project, current_user, params[:filter] || {}) params[:page] = params[:page].to_i == 0 ? nil : params[:page] diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb index 546e014d6..0c784ea73 100644 --- a/app/controllers/projects/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -9,6 +9,7 @@ class Projects::ProjectsController < Projects::BaseController def index authorize :project respond_to do |format| + format.html format.json { if not params[:search].present? @projects = Project.find(current_user.build_lists.group(:project_id).limit(10).pluck(:project_id)) diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index edefc7554..f0c70a780 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -14,12 +14,13 @@ html body[ ng-app='RosaABF' ng-controller='RosaABFController' ng-strict-di='' ng-init="init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" ng-cloak="true"] - .page-wrapper.open + .page-wrapper ng-class="{'open': toggle}" .sidebar-wrapper ul.sidebar li.sidebar-main - a href="/" - = link_to image_tag('logo-mini.png', alt: 'ABF'), root_path + a ng-click="toggleSidebar()" + = image_tag('logo-mini.png', alt: 'ABF') + span class="menu-icon glyphicon glyphicon-transfer" == render 'layouts/menu/new_top' .content-wrapper diff --git a/app/views/layouts/menu/_new_top.html.slim b/app/views/layouts/menu/_new_top.html.slim index dafcc45c0..5d027cc1c 100644 --- a/app/views/layouts/menu/_new_top.html.slim +++ b/app/views/layouts/menu/_new_top.html.slim @@ -1,9 +1,4 @@ -if current_user - -if policy(:project).dashboard? - li.sidebar-list - a href=projects_dashboard_path - =t 'dashboard.dashboard_name' - span.menu-icon.fa.fa-tachometer - (collection = t 'top_menu').each do |base, title| - if policy(base.to_s.singularize.to_sym).index? li.sidebar-list diff --git a/app/views/projects/build_lists/_buttons.html.slim b/app/views/projects/build_lists/_buttons.html.slim index ee5a6045c..6aee9e547 100644 --- a/app/views/projects/build_lists/_buttons.html.slim +++ b/app/views/projects/build_lists/_buttons.html.slim @@ -1,67 +1,71 @@ - if policy(build_list).cancel? - = link_to t("layout.build_lists.cancel"), - cancel_build_list_path(build_list), - method: :put, + .row + = link_to t("layout.build_lists.cancel"), + cancel_build_list_path(build_list), + method: :put, + data: { confirm: t('layout.confirm') }, + class: 'btn btn-primary', + 'ng-show' => 'build_list.can_cancel' + +.row.top-space ng-show="build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}" + = submit_tag t('layout.publish_again'), + data: { confirm: t("layout.publish_again_warning") }, + name: 'publish', + class: 'btn btn-primary' + +.row.top-space ng-show="build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}" + = submit_tag t('layout.publish'), + data: { confirm: t('layout.build_lists.tests_failed') }, + name: 'publish', + class: 'btn btn-primary' + +.row.top-space ng-show="build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}" + = submit_tag t('layout.publish'), data: { confirm: t('layout.confirm') }, - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => 'build_list.can_cancel' + name: 'publish', + class: 'btn btn-primary' + -= submit_tag t('layout.publish_again'), - data: { confirm: t("layout.publish_again_warning") }, - name: 'publish', - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => "build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}" - -= submit_tag t('layout.publish'), - data: { confirm: t('layout.build_lists.tests_failed') }, - name: 'publish', - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}" - -= submit_tag t('layout.publish'), - data: { confirm: t('layout.confirm') }, - name: 'publish', - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}" - -= link_to t('layout.publish_into_testing'), - publish_into_testing_build_list_path(build_list), - method: :put, - data: { confirm: t('layout.confirm') }, - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => 'build_list.can_publish_into_testing' +.row.top-space ng-show='build_list.can_publish_into_testing' + = link_to t('layout.publish_into_testing'), + publish_into_testing_build_list_path(build_list), + method: :put, + data: { confirm: t('layout.confirm') }, + class: 'btn btn-primary' - if policy(build_list).reject_publish? - = link_to t('layout.reject_publish'), - reject_publish_build_list_path(build_list), - method: :put, - data: { confirm: t('layout.confirm') }, - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => 'build_list.can_reject_publish' + .row.top-space ng-show='build_list.can_reject_publish' + = link_to t('layout.reject_publish'), + reject_publish_build_list_path(build_list), + method: :put, + data: { confirm: t('layout.confirm') }, + class: 'btn btn-primary' - if policy(build_list).rerun_tests? - = link_to t('layout.build_lists.rerun_tests'), - rerun_tests_build_list_path(build_list), - method: :put, - data: { confirm: t('layout.confirm') }, - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => "build_list.status == #{BuildList::TESTS_FAILED} || build_list.status == #{BuildList::SUCCESS}" + .row.top-space ng-show="build_list.status == #{BuildList::TESTS_FAILED} || build_list.status == #{BuildList::SUCCESS}" + = link_to t('layout.build_lists.rerun_tests'), + rerun_tests_build_list_path(build_list), + method: :put, + data: { confirm: t('layout.confirm') }, + class: 'btn btn-primary' - if policy(build_list).create_container? - = link_to t('layout.build_lists.create_container'), - create_container_build_list_path(build_list), - method: :put, - data: { confirm: t("layout.confirm") }, - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => 'build_list.can_create_container' + .row.top-space ng-show='build_list.can_create_container' + = link_to t('layout.build_lists.create_container'), + create_container_build_list_path(build_list), + method: :put, + data: { confirm: t("layout.confirm") }, + class: 'btn btn-primary' - if policy(build_list).create? - = link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(build_list.project, - build_list_id: build_list.id), - class: 'btn btn-primary roffset5 boffset5' + .row.top-space + = link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(build_list.project, + build_list_id: build_list.id), + class: 'btn btn-primary' - if can_run_dependent_build_lists?(build_list) - = link_to t('projects.build_lists.dependent_projects.title'), - dependent_projects_build_list_path(build_list), - class: 'btn btn-primary roffset5 boffset5', - 'ng-show' => 'build_list.dependent_projects_exists' + .row.top-space ng-show='build_list.dependent_projects_exists' + = link_to t('projects.build_lists.dependent_projects.title'), + dependent_projects_build_list_path(build_list), + class: 'btn btn-primary' + diff --git a/app/views/projects/build_lists/index.html.slim b/app/views/projects/build_lists/index.html.slim new file mode 100644 index 000000000..9055bf76c --- /dev/null +++ b/app/views/projects/build_lists/index.html.slim @@ -0,0 +1,80 @@ +.row.top-space + .col-md-12 ng-controller="BuildListsController" ng-init=('getBuildLists("'+params[:name_with_owner].to_s+'")') + == render 'projects/build_lists/filter' + rd-widget + rd-widget-header title="Build Lists {{::widgetTitle}}" icon="fa-gears" + .form-inline ng-init="autoreload=true" + button ng-model="autoreload" ng-click="setAutoreload(autoreload)" class="btn btn-default" uib-btn-checkbox="" + = t 'layout.autoreload_page' + button class="btn btn-default" ng-click="openFilters()" ng-disabled="isRequest" + | Filters + rd-widget-body classes="no-padding" loading="isRequest" + .row + table.table.table-condensed + thead + tr + th + th= t('activerecord.attributes.build_list.id') + th= t('activerecord.attributes.build_list.status') + th= t('activerecord.attributes.build_list.project') + th= t('diff') + th= t('activerecord.attributes.build_list.project_version') + th= t('activerecord.attributes.build_list.save_to_repository') + th= t('activerecord.attributes.build_list.arch_short') + th= t('activerecord.attributes.build_list.user') + th= t('activerecord.attributes.build_list.hostname') + tbody + tr[ ng-repeat = 'bl in build_lists' + class = '{{::bl.status_color}}' + id = 'build-list-{{::bl.id}}' + ng-class = "{'group-start': !bl.relatedHidden, 'group-end': bl.lastRelated}" + ng-show = 'bl.show' ] + td.build-list-chevrons + a.expand ng-show = '::bl.hasRelated' + span.fa.fa-chevron-down ng-show = 'bl.relatedHidden' ng-click = 'showRelated(bl)' + span.fa.fa-chevron-up ng-hide = 'bl.relatedHidden' ng-click = 'hideRelated(bl)' + / id + td.build-list-statuses + + a[ ng-href = '{{::bl.url}}' ] {{::bl.id}} + div ng-show = '::bl.hasRelated' ng-bind-html="::bl.chevronHtml" + + / status + td + | {{::bl.human_status | i18n}} + br + time ng-show = '::bl.duration' + | {{::bl.duration}} + time ng-show = '::bl.average_build_time' + | /{{::bl.average_build_time}} + + / project + td.centered ng-hide = '::bl.project' colspan = 2 + = t('layout.projects.unexisted_project') + td ng-show = '::bl.project' + | {{::bl.project.name_with_owner}} + + / diff + td + a ng-href = '{{::bl.version_link_url}}' ng-show = '::bl.project' + | {{::bl.version_link_text}} + + / project_version + td[] {{::bl.version_release}} + + / save_to_repository + td + a[ ng-href = '{{::bl.save_to_repository_url}}' ] {{::bl.save_to_repository_name}} + + / arch_short + td[ ng-show = '::bl.arch' ] {{::bl.arch.name}} + td[ ng-hide = '::bl.arch' ]= t('layout.arches.unexisted_arch') + + / user + td + a[ ng-href = '{{::bl.user.url}}' ] {{::bl.user.fullname}} + + / hostname + td[] {{::bl.hostname}} + rd-widget-footer ng-show="total_items > per_page" + == angularjs_paginate( per_page: 'per_page' ) \ No newline at end of file diff --git a/app/views/projects/build_lists/show.html.slim b/app/views/projects/build_lists/show.html.slim index 40e16d93c..ae508e9de 100644 --- a/app/views/projects/build_lists/show.html.slim +++ b/app/views/projects/build_lists/show.html.slim @@ -16,7 +16,16 @@ div[ ng-controller='BuildListController' | ) .row - div ng-class="{'col-md-6': build_list.packages || build_list.results, 'col-md-12': !build_list.packages && !build_list.results}" + .col-md-8 + = render 'packages' + .col-md-4 + = render 'shared/build_results', subject: @build_list + + .row.top-space ng-show="build_list.status == #{BuildList::BUILD_STARTED}" + = render 'shared/log', { build_started: true, get_log_path: log_build_list_path(@build_list) } + + .row.top-space + .col-md-10 rd-widget rd-widget-header title=t('layout.build_lists.main_data') rd-widget-body class="no-padding" @@ -175,19 +184,9 @@ div[ ng-controller='BuildListController' tr.alert.alert-danger ng-show='build_list.can_publish && build_list.can_publish_in_future && !build_list.can_publish_into_repository' td colspan=2 = t('flash.build_list.not_all_build_lists_success') - rd-widget-footer + .col-md-2 + rd-widget + rd-widget-header title="Actions" + rd-widget-body = form_for @build_list, url: publish_build_list_path(@build_list), html: {class: :"form-inline"} do |f| - = render 'buttons', build_list: @build_list - .col-md-6 - = render 'packages' - .top-space ng-show="build_list.packages" - = render 'shared/build_results', subject: @build_list - - .row.top-space ng-show="build_list.status == #{BuildList::BUILD_STARTED}" - = render 'shared/log', { build_started: true, get_log_path: log_build_list_path(@build_list) } - - .row.top-space - .col-md-12 - = render 'item_groups' - - .row.top-space \ No newline at end of file + = render 'buttons', build_list: @build_list \ No newline at end of file diff --git a/app/views/projects/projects/dashboard.html.slim b/app/views/projects/projects/dashboard.html.slim deleted file mode 100644 index 904a5afeb..000000000 --- a/app/views/projects/projects/dashboard.html.slim +++ /dev/null @@ -1,146 +0,0 @@ -.row.top-space - .col-md-12 - == render 'projects/build_lists/filter' - rd-widget - div ng-controller="BuildListsController" - rd-widget-header title="Build Lists{{widget_title}}" icon="fa-gears" - .form-inline ng-init="autoreload=true" - button ng-model="autoreload" ng-click="setAutoreload(autoreload)" class="btn btn-default" uib-btn-checkbox="" - = t 'layout.autoreload_page' - button class="btn btn-default" ng-click="openFilters()" ng-disabled="isRequest" - | Filters - button [class="btn btn-default" ng-show="widget_title" - ng-click="clearProject()" ng-disabled="ProjectSelectService.disable()"] - | Clear selected project - rd-widget-body classes="large no-padding" loading="isRequest" - .row - table.table.table-condensed - thead - tr - th - th= t('activerecord.attributes.build_list.id') - th= t('activerecord.attributes.build_list.status') - th= t('activerecord.attributes.build_list.project') - th= t('diff') - th= t('activerecord.attributes.build_list.project_version') - th= t('activerecord.attributes.build_list.save_to_repository') - th= t('activerecord.attributes.build_list.arch_short') - th= t('activerecord.attributes.build_list.user') - th= t('activerecord.attributes.build_list.hostname') - th= t('activerecord.attributes.build_list.updated_at') - tbody - tr[ ng-repeat = 'bl in build_lists' - class = '{{::bl.status_color}}' - id = 'build-list-{{::bl.id}}' - ng-class = "{'group-start': !bl.relatedHidden, 'group-end': bl.lastRelated}" - ng-show = 'bl.show' ] - td.build-list-chevrons - a.expand ng-show = '::bl.hasRelated' - span.fa.fa-chevron-down ng-show = 'bl.relatedHidden' ng-click = 'showRelated(bl)' - span.fa.fa-chevron-up ng-hide = 'bl.relatedHidden' ng-click = 'hideRelated(bl)' - / id - td.build-list-statuses - - a[ ng-href = '{{::bl.url}}' ] {{::bl.id}} - div ng-show = '::bl.hasRelated' ng-bind-html="::bl.chevronHtml" - - / status - td - | {{::bl.human_status | i18n}} - br - time ng-show = '::bl.duration' - | {{::bl.duration}} - time ng-show = '::bl.average_build_time' - | /{{::bl.average_build_time}} - - / project - td.centered ng-hide = '::bl.project' colspan = 2 - = t('layout.projects.unexisted_project') - td ng-show = '::bl.project' - | {{::bl.project.name_with_owner}} - - / diff - td - a ng-href = '{{::bl.version_link_url}}' ng-show = '::bl.project' - | {{::bl.version_link_text}} - - / project_version - td[] {{::bl.version_release}} - - / save_to_repository - td - a[ ng-href = '{{::bl.save_to_repository_url}}' ] {{::bl.save_to_repository_name}} - - / arch_short - td[ ng-show = '::bl.arch' ] {{::bl.arch.name}} - td[ ng-hide = '::bl.arch' ]= t('layout.arches.unexisted_arch') - - / user - td - a[ ng-href = '{{::bl.user.url}}' ] {{::bl.user.fullname}} - - / hostname - td[] {{::bl.hostname}} - - / updated_at - td title = '{{::bl.updated_at_utc}}' - | {{::bl.updated_at | amDateFormat:'YYYY-MM-DD HH:mm' }} - rd-widget-footer ng-show="total_items > per_page" - == angularjs_paginate( per_page: 'per_page' ) -.row.top-space - .col-md-6 - rd-widget - div ng-controller="ProjectsController" - rd-widget-header title=(t "dashboard.projects.title") icon="fa-cube" - input.form-control.input-sm [ng-model="search" placeholder=(t "dashboard.projects.search") - ng-change="searchProjects(search)" ng-model-options="{ debounce: 500 }"] - rd-widget-body classes="medium no-padding" loading="requesting" - .table-responsive - table.table ng-cloak=true - thead - tr - th ng-show="search" = t 'dashboard.projects.name' - th ng-hide="search" = t 'dashboard.projects.last_projects' - th - th - tbody - tr ng-repeat = 'item in projects' - td - button[ ng-click = 'selectProject(item.name_with_owner)' - ng-disabled="ProjectSelectService.disable()" class="btn btn-xs btn-link"] {{::item.name_with_owner}} - td - a[ ng-href = '{{::item.new_build_list_link}}'] = t 'dashboard.projects.new_build' - td - a[ ng-href = '{{::item.edit_link}}' - ng-show='::item.edit_link' target='_blank'] = t 'project_menu.settings' - - if policy(:project).create? - rd-widget-footer - ul.nav.nav-justified - li - = link_to t('layout.projects.new'), new_project_path, target: '_blank' - .col-md-6 - rd-widget - div ng-controller="ProjectInfoController" - rd-widget-header title=(t('dashboard.project_info.title') + '{{widget_title}}') - rd-widget-body class="medium" loading="requesting" - div ng-hide="widget_title" - = t('dashboard.project_info.select') - div ng-show="widget_title" - div - a ng-href="{{project_info.html_url}}" target="_blank" - | {{project}} - div.bottom-space - | {{project_info.description}} - div - div.bottom-space ng-repeat="commit in project_info.commits" - div - span - | {{::commit.branch}} - span.pull-right - a ng-href="{{::commit.committer_url}}" target="_blank" - | {{::commit.committer_login}} - div - a ng-href="{{::commit.url}}" target="_blank" - | {{::commit.sha}} - div - | {{::commit.message}} \ No newline at end of file diff --git a/app/views/projects/projects/index.html.slim b/app/views/projects/projects/index.html.slim new file mode 100644 index 000000000..26ad69ea8 --- /dev/null +++ b/app/views/projects/projects/index.html.slim @@ -0,0 +1,29 @@ +.row.top-space + .col-md-6 + rd-widget + div ng-controller="ProjectsController" + rd-widget-header title=(t "dashboard.projects.title") icon="fa-cube" + input.form-control.input-sm [ng-model="search" placeholder=(t "dashboard.projects.search") + ng-change="searchProjects(search)" ng-model-options="{ debounce: 500 }"] + rd-widget-body classes="medium no-padding" loading="requesting" + .table-responsive + table.table ng-cloak=true + thead + tr + th ng-show="search" = t 'dashboard.projects.name' + th ng-hide="search" = t 'dashboard.projects.last_projects' + th + th + tbody + tr ng-repeat = 'item in projects' + td + a ng-href="{{::item.project_link}}" {{::item.name_with_owner}} + td + a[ ng-href = '{{::item.new_build_list_link}}'] = t 'dashboard.projects.new_build' + td + a[ ng-href = '{{::item.edit_link}}' ng-show='::item.edit_link'] = t 'project_menu.settings' + - if policy(:project).create? + rd-widget-footer + ul.nav.nav-justified + li + = link_to t('layout.projects.new'), new_project_path, target: '_blank' \ No newline at end of file diff --git a/app/views/projects/projects/index.json.jbuilder b/app/views/projects/projects/index.json.jbuilder index b24875eac..7306bffb8 100644 --- a/app/views/projects/projects/index.json.jbuilder +++ b/app/views/projects/projects/index.json.jbuilder @@ -2,6 +2,7 @@ json.projects do json.array!(@projects) do |item| json.cache! item, expires_in: 1.minutes do json.name_with_owner item.name_with_owner + json.project_link project_build_lists_path(item.name_with_owner) json.new_build_list_link new_project_build_list_path(item.name_with_owner) json.edit_link edit_project_path(item) if policy(item).update? end diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index e6878b3ff..5947b5fe6 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -4,6 +4,8 @@ en: personal_repository: My repository products: Products top_menu: + projects: Projects + build_lists: Build Lists platforms: Platforms groups: Groups statistics: Statistics diff --git a/config/routes.rb b/config/routes.rb index fc32ff166..c978249a2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -262,8 +262,6 @@ Rails.application.routes.draw do end end - get '/projects_dashboard' => 'projects#dashboard', as: :projects_dashboard - resources :projects, only: [:index, :new, :create] scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project