[issue #279] Connection info for platform moved to partial

This commit is contained in:
George Vinogradov 2012-03-19 19:16:35 +04:00
parent d5d2b7229b
commit 2c0ccb8489
2 changed files with 36 additions and 35 deletions

View File

@ -0,0 +1,35 @@
.command_select
%h3= t("layout.platforms.sys_repos_header")
- platforms = Platform.main.open.order('name ASC')
.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").live('change', path_getter);
$("select#arch").live('change', path_getter);
$("textarea#command_string").live('click', function() {
this.select();
});
path_getter();
});

View File

@ -35,41 +35,7 @@
.both
- if @platform.platform_type == 'personal' and @platform.visibility == 'open'
.command_select
%h3= t("layout.platforms.sys_repos_header")
- platforms = Platform.main.open.order('name ASC')
.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").live('change', path_getter);
$("select#arch").live('change', path_getter);
$("textarea#command_string").live('click', function() {
this.select();
});
path_getter();
});
= render :partial => 'connection_info'
-#.block
.secondary-navigation
%ul.wat-cf