#369: use bootstrap for Platforms#show page
This commit is contained in:
parent
344cc19480
commit
1ae14ecd86
1
Gemfile
1
Gemfile
|
@ -55,6 +55,7 @@ gem "haml-rails", '~> 0.5'
|
||||||
gem 'jquery-rails', '~> 2.3'
|
gem 'jquery-rails', '~> 2.3'
|
||||||
gem 'jquery-migrate-rails'
|
gem 'jquery-migrate-rails'
|
||||||
gem 'ruby-haml-js', '~> 0.0.5'
|
gem 'ruby-haml-js', '~> 0.0.5'
|
||||||
|
gem 'slim'
|
||||||
gem 'friendly_id', '~> 5.0'
|
gem 'friendly_id', '~> 5.0'
|
||||||
|
|
||||||
gem 'rack-throttle', '~> 0.3.0'
|
gem 'rack-throttle', '~> 0.3.0'
|
||||||
|
|
|
@ -461,6 +461,9 @@ GEM
|
||||||
thin (~> 1.5.0)
|
thin (~> 1.5.0)
|
||||||
skype (0.2.8)
|
skype (0.2.8)
|
||||||
tmp_cache
|
tmp_cache
|
||||||
|
slim (2.1.0)
|
||||||
|
temple (~> 0.6.9)
|
||||||
|
tilt (>= 1.3.3, < 2.1)
|
||||||
soundmanager-rails (1.0.1)
|
soundmanager-rails (1.0.1)
|
||||||
sprockets (2.11.0)
|
sprockets (2.11.0)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
|
@ -476,6 +479,7 @@ GEM
|
||||||
sqlite3 (>= 1.3.3)
|
sqlite3 (>= 1.3.3)
|
||||||
state_machine (1.2.0)
|
state_machine (1.2.0)
|
||||||
stringex (2.5.2)
|
stringex (2.5.2)
|
||||||
|
temple (0.6.9)
|
||||||
test_after_commit (0.2.5)
|
test_after_commit (0.2.5)
|
||||||
activerecord (>= 3.2)
|
activerecord (>= 3.2)
|
||||||
therubyracer (0.12.1)
|
therubyracer (0.12.1)
|
||||||
|
@ -610,6 +614,7 @@ DEPENDENCIES
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
sitemap_generator
|
sitemap_generator
|
||||||
skype
|
skype
|
||||||
|
slim
|
||||||
soundmanager-rails
|
soundmanager-rails
|
||||||
state_machine (~> 1.2)
|
state_machine (~> 1.2)
|
||||||
test_after_commit
|
test_after_commit
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
RosaABF.controller 'PlatformSysReposController', ['$scope', '$http', ($scope, $http) ->
|
||||||
|
|
||||||
|
$scope.init = (platform_id) ->
|
||||||
|
path = Routes.platform_path platform_id
|
||||||
|
$http.get(path, { format: 'json' }).success (res) ->
|
||||||
|
$scope.list = res.list
|
||||||
|
$scope.platforms = res.platforms
|
||||||
|
$scope.arches = res.arches
|
||||||
|
|
||||||
|
$scope.platform = res.platforms[0]
|
||||||
|
$scope.arch = res.arches[0]
|
||||||
|
$scope.updateCommand()
|
||||||
|
|
||||||
|
$scope.updateCommand = ->
|
||||||
|
if $scope.platform && $scope.arch
|
||||||
|
$scope.command = $scope.list[$scope.platform][$scope.arch]
|
||||||
|
else
|
||||||
|
$scope.command = ''
|
||||||
|
|
||||||
|
|
||||||
|
$scope.selectAll = ($event) ->
|
||||||
|
target = $($event.currentTarget)
|
||||||
|
target.select()
|
||||||
|
false
|
||||||
|
|
||||||
|
]
|
|
@ -1,6 +1,6 @@
|
||||||
class Platforms::PlatformsController < Platforms::BaseController
|
class Platforms::PlatformsController < Platforms::BaseController
|
||||||
include FileStoreHelper
|
include FileStoreHelper
|
||||||
layout 'bootstrap', only: [:index]
|
layout 'bootstrap'#, only: [:index]
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
skip_before_filter :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
|
skip_before_filter :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
module PlatformsHelper
|
module PlatformsHelper
|
||||||
|
|
||||||
def repository_name_postfix(platform)
|
def repository_name_postfix(platform)
|
||||||
return "" unless platform
|
return "" unless platform
|
||||||
return platform.released ? '/update' : '/release'
|
return platform.released ? '/update' : '/release'
|
||||||
|
|
|
@ -142,10 +142,11 @@ class Platform < ActiveRecord::Base
|
||||||
|
|
||||||
# TODO: rename method or create separate methods for mdv and rhel
|
# TODO: rename method or create separate methods for mdv and rhel
|
||||||
# Platform.main.opened.where(distrib_type: APP_CONFIG['distr_types'].first).each do |pl|
|
# Platform.main.opened.where(distrib_type: APP_CONFIG['distr_types'].first).each do |pl|
|
||||||
|
arches = Arch.all.to_a
|
||||||
Platform.main.opened.each do |pl|
|
Platform.main.opened.each do |pl|
|
||||||
urpmi_commands[pl.name] = {}
|
urpmi_commands[pl.name] = {}
|
||||||
# FIXME should support restricting access to the hidden platform
|
# FIXME should support restricting access to the hidden platform
|
||||||
Arch.all.each do |arch|
|
arches.each do |arch|
|
||||||
tail = "/#{arch.name}/#{repository_name}/release"
|
tail = "/#{arch.name}/#{repository_name}/release"
|
||||||
command = add_commands ? "urpmi.addmedia #{name} " : ''
|
command = add_commands ? "urpmi.addmedia #{name} " : ''
|
||||||
command << "#{APP_CONFIG['downloads_url']}/#{name}/repository/#{pl.name}#{tail}"
|
command << "#{APP_CONFIG['downloads_url']}/#{name}/repository/#{pl.name}#{tail}"
|
||||||
|
|
|
@ -1,5 +1,78 @@
|
||||||
|
/ - content_for :submenu do
|
||||||
|
/ - act = action_name.to_sym; contr = controller_name.to_sym
|
||||||
|
/ .left= platform_printed_name(@platform)
|
||||||
|
/ %nav
|
||||||
|
/ %ul
|
||||||
|
|
||||||
- content_for :submenu do
|
- content_for :submenu do
|
||||||
- act = action_name.to_sym; contr = controller_name.to_sym
|
- act = action_name.to_sym; contr = controller_name.to_sym
|
||||||
.left= platform_printed_name(@platform)
|
%nav.navbar.navbar-default{ role: 'navigation' }
|
||||||
%nav
|
.container-fluid
|
||||||
%ul
|
/ Brand and toggle get grouped for better mobile display
|
||||||
|
.navbar-header
|
||||||
|
%button.navbar-toggle{ 'data-target' => '#submenu-navbar-collapse', 'data-toggle' => 'collapse', type: 'button' }
|
||||||
|
%span.sr-only Toggle navigation
|
||||||
|
%span.icon-bar
|
||||||
|
%span.icon-bar
|
||||||
|
%span.icon-bar
|
||||||
|
.navbar-brand
|
||||||
|
= link_to platform_printed_name(@platform), @platform
|
||||||
|
/ Collect the nav links, forms, and other content for toggling
|
||||||
|
#submenu-navbar-collapse.collapse.navbar-collapse
|
||||||
|
%ul.nav.navbar-nav.left-border
|
||||||
|
|
||||||
|
%li{class: (act == :show && contr == :platforms) ? 'active' : ''}
|
||||||
|
= link_to t("layout.platforms.about"), platform_path(@platform)
|
||||||
|
%li{class: (contr == :repositories) ? 'active' : ''}
|
||||||
|
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
|
||||||
|
%li{class: (contr == :contents) ? 'active' : ''}
|
||||||
|
= link_to t('layout.platforms.contents'), platform_contents_path(@platform)
|
||||||
|
- if can? :show, @platform
|
||||||
|
%li{class: (act == :index && contr == :maintainers) ? 'active' : nil}
|
||||||
|
= link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform)
|
||||||
|
%li{class: (contr == :mass_builds) ? 'active' : ''}
|
||||||
|
= link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform)
|
||||||
|
- if can? :read, @platform.products.build
|
||||||
|
%li{class: (contr == :products) ? 'active' : ''}
|
||||||
|
= link_to t("layout.products.list_header"), platform_products_path(@platform)
|
||||||
|
- if can? :advisories, @platform
|
||||||
|
%li{class: (contr == :platforms and act == :advisories) ? 'active' : ''}
|
||||||
|
= link_to t("layout.advisories.list_header"), advisories_platform_path(@platform)
|
||||||
|
- if can? :update, @platform
|
||||||
|
%li{class: (act == :edit && contr == :platforms) ? 'active' : nil}
|
||||||
|
= link_to t("platform_menu.settings"), edit_platform_path(@platform)
|
||||||
|
- if can? :members, @platform
|
||||||
|
%li{class: (act == :members && contr == :platforms) ? 'active' : nil}
|
||||||
|
= link_to t("layout.platforms.members"), members_platform_path(@platform)
|
||||||
|
- if can? :edit, @platform
|
||||||
|
%li{class: (act == :index && contr == :key_pairs) ? 'active' : ''}
|
||||||
|
= link_to t("layout.key_pairs.header"), platform_key_pairs_path(@platform)
|
||||||
|
%li{class: (contr == :tokens) ? 'active' : ''}
|
||||||
|
= link_to t('layout.tokens.header'), platform_tokens_path(@platform)
|
||||||
|
|
||||||
|
/ - if @project.parent
|
||||||
|
/ %li
|
||||||
|
/ = link_to project_path(@project.parent), class: 'small' do
|
||||||
|
/ = fa_icon 'code-fork'
|
||||||
|
/ = @project.parent.name_with_owner
|
||||||
|
/ %li{ class: ('active' if act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits) }
|
||||||
|
/ = link_to t('project_menu.code'), tree_path(@project, treeish)
|
||||||
|
/ - if @project.is_package and can?(:read, @project => BuildList)
|
||||||
|
/ %li{ class: ('active' if contr == :build_lists) }
|
||||||
|
/ = link_to t('project_menu.builds'), project_build_lists_path(@project)
|
||||||
|
|
||||||
|
/ - if @project.has_issues
|
||||||
|
/ %li{ class: ('active' if contr == :issues) }
|
||||||
|
/ = link_to t('project_menu.tracker', count: @opened_issues_count), project_issues_path(@project)
|
||||||
|
/ %li{ class: ('active' if contr == :pull_requests) }
|
||||||
|
/ =link_to t('project_menu.pull_requests', count: @opened_pull_requests_count), project_pull_requests_path(@project)
|
||||||
|
/ - if @project.has_wiki
|
||||||
|
/ %li{ class: ('active' if contr == :wiki) }
|
||||||
|
/ = link_to t('project_menu.wiki'), project_wiki_index_path(@project)
|
||||||
|
/ %li=# link_to t('project_menu.readme'), '#' #pending
|
||||||
|
/ - if can? :update, @project
|
||||||
|
/ %li{ class: ('active' if act == :edit && contr == :projects) }
|
||||||
|
/ = link_to t('project_menu.settings'), edit_project_path(@project)
|
||||||
|
/ / /.navbar-collapse
|
||||||
|
/ / /.container-fluid
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
- platforms = Platform.main.opened.where(distrib_type: APP_CONFIG['distr_types'].first).order('name ASC')
|
|
||||||
|
|
||||||
- if platforms.count > 0
|
|
||||||
.command_select
|
|
||||||
%h3= t("layout.platforms.sys_repos_header")
|
|
||||||
|
|
||||||
.leftlist= label_tag :platform, t("layout.platforms.target_platform")
|
|
||||||
.rightlist= select_tag :platform, options_from_collection_for_select(platforms, :name, :name, platforms.first.id)
|
|
||||||
.both
|
|
||||||
|
|
||||||
- arches = Arch.order('name ASC')
|
|
||||||
.leftlist= label_tag :arch, t("layout.platforms.target_architecture")
|
|
||||||
.rightlist= select_tag :arch, options_from_collection_for_select(arches, :name, :name, arches.first.id)
|
|
||||||
.both
|
|
||||||
|
|
||||||
.rightlist
|
|
||||||
%textarea{id: 'command_string', readonly: 'readonly'}
|
|
||||||
.both
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function(){
|
|
||||||
var path_getter = function() {
|
|
||||||
var list = #{@platform.urpmi_list(request.host).to_json};
|
|
||||||
var $platform = $("select#platform");
|
|
||||||
var $arch = $("select#arch");
|
|
||||||
|
|
||||||
$('#command_string').val(list[$platform.val()][$arch.val()]);
|
|
||||||
// alert('hello');
|
|
||||||
}
|
|
||||||
$("select#platform").on('change', path_getter);
|
|
||||||
$("select#arch").on('change', path_getter);
|
|
||||||
$("textarea#command_string").on('click', function() {
|
|
||||||
this.select();
|
|
||||||
});
|
|
||||||
path_getter();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
-set_meta_tags title: title_object(@platform)
|
|
||||||
= render 'submenu'
|
|
||||||
= render 'sidebar'
|
|
||||||
|
|
||||||
%h3.fix
|
|
||||||
= t 'layout.platforms.about'
|
|
||||||
= link_to @platform.name, platform_contents_path(@platform)
|
|
||||||
|
|
||||||
%p= @platform.description
|
|
||||||
|
|
||||||
%table.tablesorter.unbordered
|
|
||||||
- if @platform.parent
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b= "#{t("activerecord.attributes.platform.parent")}:"
|
|
||||||
%td= link_to @platform.parent.description, platform_path(@platform.parent)
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b= "#{t('layout.platforms.owner')}:"
|
|
||||||
%td= link_to @platform.owner.try(:name), url_for(@platform.owner)
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b= "#{t('layout.platforms.visibility')}:"
|
|
||||||
%td= t("layout.visibilities.#{@platform.visibility}")
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b= "#{t('layout.platforms.platform_type')}:"
|
|
||||||
%td= @platform.platform_type
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b= "#{t('layout.platforms.distrib_type')}:"
|
|
||||||
%td= @platform.distrib_type
|
|
||||||
|
|
||||||
.buttons_block
|
|
||||||
= link_to I18n.t("layout.platforms.clone"), clone_platform_path(@platform), class: "button left_floated" if can? :clone, @platform
|
|
||||||
|
|
||||||
= render 'connection_info' if @platform.platform_type == 'personal' and @platform.visibility == 'open'
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
-set_meta_tags title: title_object(@platform)
|
||||||
|
= render 'submenu'
|
||||||
|
/ = render 'sidebar'
|
||||||
|
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
h3
|
||||||
|
= t('layout.platforms.about')
|
||||||
|
|
|
||||||
|
= link_to @platform.name, platform_contents_path(@platform)
|
||||||
|
dl.dl-horizontal
|
||||||
|
dt= t('activerecord.attributes.platform.description')
|
||||||
|
dd= @platform.description
|
||||||
|
|
||||||
|
- if @platform.parent
|
||||||
|
dt= t('activerecord.attributes.platform.parent')
|
||||||
|
dd= link_to @platform.parent.description, platform_path(@platform.parent)
|
||||||
|
|
||||||
|
dt= t('layout.platforms.owner')
|
||||||
|
dd= link_to @platform.owner.try(:name), url_for(@platform.owner)
|
||||||
|
|
||||||
|
dt= t('layout.platforms.visibility')
|
||||||
|
dd= t("layout.visibilities.#{@platform.visibility}")
|
||||||
|
|
||||||
|
dt= t('layout.platforms.platform_type')
|
||||||
|
dd= @platform.platform_type
|
||||||
|
|
||||||
|
dt= t('layout.platforms.distrib_type')
|
||||||
|
dd= @platform.distrib_type
|
||||||
|
|
||||||
|
- if can? :clone, @platform
|
||||||
|
dt
|
||||||
|
dd
|
||||||
|
a.btn.btn-primary href=clone_platform_path(@platform)
|
||||||
|
= t('layout.platforms.clone')
|
||||||
|
|
||||||
|
- if @platform.platform_type == 'personal' and @platform.visibility == 'open'
|
||||||
|
.col-md-6 ng-controller='PlatformSysReposController' ng-init="init(#{@platform.id})"
|
||||||
|
h3= t('layout.platforms.sys_repos_header')
|
||||||
|
dl.dl-horizontal
|
||||||
|
dt= t('layout.platforms.target_platform')
|
||||||
|
dd
|
||||||
|
select ng-model='platform' ng-change='updateCommand()'
|
||||||
|
option ng-repeat='platform in platforms' ng-value='platform'
|
||||||
|
| {{ platform }}
|
||||||
|
|
||||||
|
dt= t('layout.platforms.target_architecture')
|
||||||
|
dd
|
||||||
|
select ng-model='arch' ng-change='updateCommand()'
|
||||||
|
option ng-repeat='arch in arches' ng-value='arch'
|
||||||
|
| {{ arch }}
|
||||||
|
br
|
||||||
|
textarea.form-control readonly='readonly' ng-model='command' rows=3 ng-click='selectAll($event)'
|
|
@ -0,0 +1,6 @@
|
||||||
|
platforms = Platform.main.opened.
|
||||||
|
where(distrib_type: APP_CONFIG['distr_types'].first).order('name ASC')
|
||||||
|
|
||||||
|
json.list @platform.urpmi_list(request.host)
|
||||||
|
json.platforms platforms.pluck(:name)
|
||||||
|
json.arches Arch.order('name ASC').pluck(:name)
|
Loading…
Reference in New Issue