From f33272f8aa0707bee4be22797136421be70941f8 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 18 Feb 2014 01:53:35 +0400 Subject: [PATCH] #354: start UI --- .../controllers/project_schedule_controller.js | 17 +++++++++++++++++ app/views/projects/projects/_form.html.haml | 10 ---------- app/views/projects/projects/edit.html.haml | 11 +++++++++++ config/locales/models/project.en.yml | 1 + config/locales/models/project.ru.yml | 1 + 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 app/assets/javascripts/angularjs/controllers/project_schedule_controller.js diff --git a/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js b/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js new file mode 100644 index 000000000..92c9a6b3a --- /dev/null +++ b/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js @@ -0,0 +1,17 @@ +RosaABF.controller('ProjectScheduleController', ['$scope', '$http', function($scope, $http) { + + // See: Platfrom::AUTOMATIC_METADATA_REGENERATIONS + // $scope.items = { + // 'day': 'platform.automatic_metadata_regeneration.day', + // 'week': 'platform.automatic_metadata_regeneration.week' + // }; + $scope.project_id = null; + + $scope.update = function() { + $http.put( + Routes.project_path($scope.platform_id), + {project: {autostart_status: $scope.autostart_status}, format: 'json'} + ); + } + +}]); \ No newline at end of file diff --git a/app/views/projects/projects/_form.html.haml b/app/views/projects/projects/_form.html.haml index bc313eb3b..0b623ef9b 100644 --- a/app/views/projects/projects/_form.html.haml +++ b/app/views/projects/projects/_form.html.haml @@ -56,16 +56,6 @@ id_element: '#project_maintainer_id', placeholder: @project.maintainer.fullname - %h3= t("layout.projects.build_schedule") - = form_for @project, html: { class: :form, multipart: true } do |f| - .leftlist= f.label :default_platforms - .rightlist= f.select :default_platforms, Platform.main.map{ |p| [p.name, p.id] }, {include_blank: true}, multiple: true, size: 5 - .both - - .leftlist= f.label :autostart_status - .rightlist= f.select :autostart_status, Project::AUTOSTART_STATUSES.collect{|status| [Project.human_autostart_status(status), status]}, {include_blank: true, selected: @project.autostart_status} - .both - - if [:new, :create].include? act .leftlist= f.label :srpm .rightlist= f.file_field :srpm, class: 'file_field' diff --git a/app/views/projects/projects/edit.html.haml b/app/views/projects/projects/edit.html.haml index e801bc2ce..e31f8e927 100644 --- a/app/views/projects/projects/edit.html.haml +++ b/app/views/projects/projects/edit.html.haml @@ -4,6 +4,17 @@ = form_for @project, html: { class: :form, multipart: true } do |f| = render "form", f: f +.hr + +%h3= t("layout.projects.build_schedule") += form_for @project, html: { class: :form, multipart: true, 'ng-controller' => 'ProjectScheduleController', 'ng-init' => "project_id = #{@project.id}" } do |f| + / .leftlist= f.label :default_platforms + / .rightlist= f.select :default_platforms, Platform.main.map{ |p| [p.name, p.id] }, {include_blank: true}, multiple: true, size: 5 + / .both + + .leftlist= f.label :autostart_status + .rightlist= f.select :autostart_status, Project::AUTOSTART_STATUSES.collect{|status| [Project.human_autostart_status(status), status]}, {include_blank: true, selected: @project.autostart_status} + .both .hr .leftside= t("layout.projects.delete_warning") diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index e2b776706..eef753e8e 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -93,6 +93,7 @@ en: attributes: project: url: URL + autostart_status: Autostart add_to_repository_id: Add to repository srpms_list: SRPMs list name: Name diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index 1f495364a..6d8e90e50 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -93,6 +93,7 @@ ru: attributes: project: url: URL + autostart_status: Автостарт add_to_repository_id: Добавить в репозиторий srpms_list: Список SRPMs name: Название