app/assets/javascripts/katello/content_search/content_search.js in katello-1.5.0 vs app/assets/javascripts/katello/content_search/content_search.js in katello-2.2.2
- old
+ new
@@ -1,7 +1,7 @@
/**
- Copyright 2013 Red Hat, Inc.
+ Copyright 2014 Red Hat, Inc.
This software is licensed to you under the GNU General Public
License as published by the Free Software Foundation; either version
2 of the License (GPLv2) or (at your option) any later version.
There is NO WARRANTY for this software, express or implied,
@@ -17,18 +17,16 @@
KT.widgets = {repos:{id:"repos_selector", autocomplete:'repo_autocomplete_list', search:'repo_search'},
packages:{id:"packages_selector", search:'package_search'},
products:{id:"products_selector", autocomplete:'product_autocomplete_list'},
views:{id:"views_selector", autocomplete:'view_autocomplete_list'},
- errata:{id:"errata_selector", search:'errata_search'},
puppet_modules: {id:"puppet_modules_selector", search:'puppet_modules_search'}};
KT.mapping = {views:['views'],
products:['views', 'products'],
repos:['views', 'products', 'repos'],
packages:['products', 'repos', 'packages', 'views'],
- errata:['products', 'repos', 'errata', 'views'],
puppet_modules:['views', 'products', 'repos', 'puppet_modules']};
var search = KT.content_search(KT.available_environments);
$('#content_selector select').chosen();
@@ -42,28 +40,10 @@
display["url"] = KT.routes.details_package_path(KT.utils.escape(display["id"]));
return KT.utils.template("<span data-url='<%= url %>' class='tipsify-package'><%- name %></span> \
<span class='one-line-ellipsis'><%- vel_rel_arch %></span>", display);
},
- errata_header = function(display) {
- if(display["errata_type"] === "bugfix") {
- display["icon_class"] = "bug_icon-black";
- }
- else if(display["errata_type"] === "enhancement") {
- display["icon_class"] = "plus_icon-black";
- }
- else if(display["errata_type"] === "security") {
- display["icon_class"] = "shield_icon-black";
- }
- else {
- display["icon_class"] = "enhancement_icon";
- }
- display["url"] = KT.routes.short_details_erratum_path(KT.utils.escape(display["id"]));
-
- return KT.utils.template("<i class=\"errata-icon <%= icon_class %>\"></i><span class=\"tipsify-errata\" data-url=\"<%= url %>\"><%- errata_id %></span>",
- display);
- },
puppet_module_header = function(display) {
display["url"] = KT.routes.puppet_module_path(KT.utils.escape(display["id"]));
display["author_label"] = i18n.author;
return KT.utils.template("<span data-url='<%= url %>' class='tipsify-package'><%- name_version %></span> \
@@ -71,13 +51,10 @@
},
row_header_content = function(name, type) {
if(type === "package") {
html = package_header(name);
}
- else if(type === "errata") {
- html = errata_header(name);
- }
else if(type === "puppet_module") {
html = puppet_module_header(name);
}
else {
html = KT.utils.escape(name);
@@ -176,115 +153,88 @@
return {
row_header : row_header,
row_header_content : row_header_content,
column_header : column_header
};
-}(i18n));
+}(katelloI18n));
KT.content_search = function(paths_in){
var browse_box, old_search_params, env_select, paths,
cache = KT.content_search_cache,
utils = KT.utils,
comparison_grid,
subgrids = {
repo_packages:{id:'repo_packages',
- name:i18n.packages,
+ name:katelloI18n.packages,
url:KT.routes.repo_packages_content_search_index_path(),
- cols:{description:{id:'description', name:i18n.description, span : "7"}},
- selector:['repo_packages', 'repo_errata', 'repo_puppet_modules']
+ cols:{description:{id:'description', name:katelloI18n.description, span : "7"}},
+ selector:['repo_packages', 'repo_puppet_modules']
},
- repo_errata :{id:'repo_errata',
- name:i18n.errata,
- url:KT.routes.repo_errata_content_search_index_path(),
- cols:{
- title : {id:'title', name:i18n.title, span: "2"},
- type : {id:'type', name:i18n.type},
- severity : {id:'severity', name:i18n.severity}
- },
- selector:['repo_packages', 'repo_errata', 'repo_puppet_modules']
- },
repo_puppet_modules:{id:'repo_puppet_modules',
- name:i18n.puppet_modules,
+ name:katelloI18n.puppet_modules,
url:KT.routes.repo_puppet_modules_content_search_index_path(),
- cols:{description:{id:'description', name:i18n.description, span : "7"}},
- selector:['repo_packages', 'repo_errata', 'repo_puppet_modules']
+ cols:{description:{id:'description', name:katelloI18n.description, span : "7"}},
+ selector:['repo_packages', 'repo_puppet_modules']
},
repo_compare_packages:{id:'repo_compare_packages',
- name:i18n.packages,
+ name:katelloI18n.packages,
url:KT.routes.repo_compare_packages_content_search_index_path(),
- selector:['repo_compare_packages', 'repo_compare_errata', 'repo_compare_puppet_modules'],
+ selector:['repo_compare_packages', 'repo_compare_puppet_modules'],
modes: true
},
- repo_compare_errata:{id:'repo_compare_errata',
- name:i18n.errata,
- url:KT.routes.repo_compare_errata_content_search_index_path(),
- selector:['repo_compare_packages', 'repo_compare_errata', 'repo_compare_puppet_modules'],
- modes: true
- },
repo_compare_puppet_modules:{id:'repo_compare_puppet_modules',
- name:i18n.puppet_modules,
+ name:katelloI18n.puppet_modules,
url:KT.routes.repo_compare_puppet_modules_content_search_index_path(),
- selector:['repo_compare_packages', 'repo_compare_errata', 'repo_compare_puppet_modules'],
+ selector:['repo_compare_packages', 'repo_compare_puppet_modules'],
modes: true
},
view_compare_packages:{id:'view_compare_packages',
- name:i18n.packages,
+ name:katelloI18n.packages,
url:KT.routes.view_compare_packages_content_search_index_path(),
- selector:['view_compare_packages', 'view_compare_errata', 'view_compare_puppet_modules'],
+ selector:['view_compare_packages', 'view_compare_puppet_modules'],
modes: true
},
- view_compare_errata:{id:'view_compare_errata',
- name:i18n.errata,
- url:KT.routes.view_compare_errata_content_search_index_path(),
- selector:['view_compare_packages', 'view_compare_errata', 'view_compare_puppet_modules'],
- modes: true
- },
view_compare_puppet_modules:{id:'view_compare_puppet_modules',
- name:i18n.puppet_modules,
+ name:katelloI18n.puppet_modules,
url:KT.routes.view_compare_puppet_modules_content_search_index_path(),
- selector:['view_compare_packages', 'view_compare_errata', 'view_compare_puppet_modules'],
+ selector:['view_compare_packages', 'view_compare_puppet_modules'],
modes: true
}
},
- search_modes = [{id:'all', name:i18n.union},
- {id:'shared', name:i18n.intersection},
- {id:'unique', name:i18n.difference}
+ search_modes = [{id:'all', name:katelloI18n.union},
+ {id:'shared', name:katelloI18n.intersection},
+ {id:'unique', name:katelloI18n.difference}
],
- search_pages = {errata:{url:KT.routes.errata_content_search_index_path(), modes:true},
- repos:{url:KT.routes.repos_content_search_index_path(), modes:true, comparable:true},
+ search_pages = {repos:{url:KT.routes.repos_content_search_index_path(), modes:true, comparable:true},
products:{url:KT.routes.products_content_search_index_path(), modes:true},
views:{url:KT.routes.views_content_search_index_path(), modes:true, comparable:true},
packages:{url:KT.routes.packages_content_search_index_path(), modes:true},
puppet_modules:{url:KT.routes.puppet_modules_content_search_index_path(), modes:true}
},
more_results_urls = {
- errata: {method:"POST", url:KT.routes.errata_items_content_search_index_path(), include_search:true},
packages: {method:"POST", url:KT.routes.packages_items_content_search_index_path(), include_search:true},
puppet_modules: {method:"POST", url:KT.routes.puppet_modules_items_content_search_index_path(), include_search:true},
repo_packages:{method:"GET", url:KT.routes.repo_packages_content_search_index_path(), include_search:false},
- repo_errata: {method:"GET", url:KT.routes.repo_errata_content_search_index_path(), include_search:false},
repo_puppet_modules:{method:"GET", url:KT.routes.repo_puppet_modules_content_search_index_path(), include_search:false},
repo_compare_packages: {method:"GET", url:KT.routes.repo_compare_packages_content_search_index_path(), include_search:false},
- repo_compare_errata: {method:"GET", url:KT.routes.repo_compare_errata_content_search_index_path(), include_search:false},
repo_compare_puppet_modules: {method:"GET", url:KT.routes.repo_compare_puppet_modules_content_search_index_path(), include_search:false},
view_compare_packages: {method:"GET", url:KT.routes.view_packages_content_search_index_path(), include_search:false},
- view_compare_errata: {method:"GET", url:KT.routes.view_packages_content_search_index_path(), include_search:false},
view_compare_puppet_modules: {method:"GET", url:KT.routes.view_puppet_modules_content_search_index_path(), include_search:false}
};
var init = function(){
var initial_search = $.bbq.getState('search'),
footer;
paths = paths_in;
if( KT.permissions.current_organization.editable ){
- footer = $('<a/>', { "href" : KT.routes.organizations_path({ anchor : 'panel=organization_' + KT.permissions.current_organization['id'] + '&panelpage=edit' })});
- footer.append($('<i/>', { "class" : "gears_icon", "data-change_on_hover" : "dark" }));
- footer.append($('<span/>').html(i18n.manage_environments));
+ footer = $('<a/>', { "href" : "/lifecycle_environments"});
+ footer.append($('<i/>', { "class" : "icon-gears", "data-change_on_hover" : "dark" }));
+ footer.append($('<span/>').html(katelloI18n.manage_environments));
footer = footer[0].outerHTML;
} else {
footer = "";
}
@@ -747,11 +697,11 @@
ac_obj = KT.auto_complete_box(
{values:ac_container.data('url'),
require_select: true,
input: ac_container.find('input:text'),
add_btn: ac_container.find('.button'),
- add_text: i18n.add,
+ add_text: katelloI18n.add,
selected_input: ac_container.find('.hidden_selection'),
add_cb: function(item, id, cleanup){
auto_select(item, id);
cleanup();
}
@@ -870,18 +820,18 @@
var type_search = {};
query[value] = widgets[value].finder.get_results();
});
query.content_type = content_type;
$(document).trigger(event_name, query);
- get_submit_btn().val(i18n.refresh_results);
+ get_submit_btn().val(katelloI18n.refresh_results);
},
get_submit_btn = function(){
return selector.parents('form').find('input[type=submit]');
},
change_selection = function(selected){
var needed = mapping[selected],
element;
- get_submit_btn().val(i18n.search);
+ get_submit_btn().val(katelloI18n.search);
utils.each(widgets, function(value, key){
element = $('#' + value.id);
if (utils.include(needed, key)){
element.show();