-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy JavaScript files into obs_factory namespace
In the copy we remove code that for sure is not going to be used in obs_factory. The original files are not removed yet.
- Loading branch information
Showing
7 changed files
with
626 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
src/api/app/assets/javascripts/webui/obs_factory/application.js.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// the compiled file. | ||
// | ||
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD | ||
// GO AFTER THE REQUIRES BELOW. | ||
// | ||
//= require jquery | ||
//= require jquery.ui.menu | ||
//= require jquery.ui.tooltip | ||
//= require jquery_ujs | ||
//= require cocoon | ||
//= require moment | ||
//= require mousetrap | ||
//= require peek | ||
// | ||
//= require webui/obs_factory/keybindings.js.coffee | ||
//= require webui/obs_factory/bento/script.js | ||
//= require webui/obs_factory/bento/global-navigation.js | ||
//= require webui/obs_factory/bento/l10n/global-navigation-data-en_US.js | ||
|
||
function remove_dialog() { | ||
$(this).parents('.dialog:visible').remove(); | ||
$('.overlay').hide(); | ||
} | ||
|
||
function fillEmptyFields() { | ||
if (document.getElementById('username').value === '') { | ||
document.getElementById('username').value = "_"; | ||
} | ||
if (document.getElementById('password').value === '') { | ||
document.getElementById('password').value = "_"; | ||
} | ||
} | ||
|
||
function toggleBox(link, box) { | ||
//calculating offset for displaying popup message | ||
var leftVal = link.position().left + "px"; | ||
var topVal = link.position().bottom + "px"; | ||
$(box).css({ | ||
left: leftVal, | ||
top: topVal | ||
}).toggle(); | ||
} | ||
|
||
function callPiwik() { | ||
var u = (("https:" == document.location.protocol) ? "https://beans.opensuse.org/piwik/" : "http://beans.opensuse.org/piwik/"); | ||
_paq.push(['setSiteId', 8]); | ||
_paq.push(['setTrackerUrl', u + 'piwik.php']); | ||
_paq.push(['trackPageView']); | ||
_paq.push(['setDomains', ["*.opensuse.org"]]); | ||
var d = document, | ||
g = d.createElement('script'), | ||
s = d.getElementsByTagName('script')[0]; | ||
g.type = 'text/javascript'; | ||
g.defer = true; | ||
g.async = true; | ||
g.src = u + 'piwik.js'; | ||
s.parentNode.insertBefore(g, s); | ||
} | ||
|
||
$(document).ajaxSend(function (event, request, settings) { | ||
if (typeof(CSRF_PROTECT_AUTH_TOKEN) == "undefined") return; | ||
// settings.data is a serialized string like "foo=bar&baz=boink" (or null) | ||
settings.data = settings.data || ""; | ||
settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(CSRF_PROTECT_AUTH_TOKEN); | ||
}); | ||
|
||
// Could be handy elsewhere ;-) | ||
var URL_REGEX = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi; | ||
|
||
function change_role(obj) { | ||
var td = obj.parent("td"); | ||
var type = td.data("type"); | ||
var role = td.data("role"); | ||
|
||
var url; | ||
var data = {project: $('#involved-users').data("project"), package: $('#involved-users').data("package"), role: role}; | ||
data[type + 'id'] = td.data(type); | ||
if (obj.is(':checked')) { | ||
url = $('#involved-users').data("save-" + type); | ||
} else { | ||
url = $('#involved-users').data("remove"); | ||
} | ||
|
||
$('#' + type + '_spinner').show(); | ||
$('#' + type + '_table input').animate({opacity: 0.2}, 500); | ||
$('#' + type + '_table input').prop("disabled", true); | ||
|
||
$.ajax({ | ||
url: url, | ||
type: 'POST', | ||
data: data, | ||
complete: function () { | ||
$('#' + type + '_spinner').hide(); | ||
$('#' + type + '_table input').animate({opacity: 1}, 200); | ||
$('#' + type + '_table input').prop('disabled', false); | ||
} | ||
}); | ||
} | ||
|
||
function collapse_expand(file_id) { | ||
var placeholder = $('#diff_view_' + file_id + '_placeholder'); | ||
if (placeholder.attr('id')) { | ||
$.ajax({ | ||
url: placeholder.parents('.table_wrapper').data("url"), | ||
type: 'POST', | ||
data: { text: placeholder.text(), uid: placeholder.data('uid') }, | ||
success: function (data) { | ||
$('#diff_view_' + file_id).show(); | ||
$('#diff_view_' + file_id + '_placeholder').html(data); | ||
$('#diff_view_' + file_id + '_placeholder').attr('id', ''); | ||
use_codemirror(placeholder.data('uid'), true, placeholder.data("mode")); | ||
$('#collapse_' + file_id).show(); | ||
$('#expand_' + file_id).hide(); | ||
}, | ||
error: function (data) { | ||
$('#diff_view_' + file_id).hide(); | ||
$('#collapse_' + file_id).hide(); | ||
$('#expand_' + file_id).show(); | ||
}, | ||
}); | ||
} else { | ||
$('#diff_view_' + file_id).toggle(); | ||
$('#collapse_' + file_id).toggle(); | ||
$('#expand_' + file_id).toggle(); | ||
} | ||
} | ||
|
||
$(function() { | ||
$('.show_dialog').on('click', function() { | ||
$($(this).data('target')).removeClass('hidden'); | ||
$('.overlay').show(); | ||
}); | ||
}); | ||
|
||
$(document).on('click','.close-dialog', function() { | ||
var target = $(this).data('target'); | ||
if (target) { | ||
$(target).addClass('hidden'); | ||
$('.overlay').hide(); | ||
} | ||
}); | ||
|
||
// show/hide functionality for text | ||
$(function() { | ||
$('.show-hide').on('click', function() { | ||
var target = $(this).data('target'); | ||
$(target).toggle(); | ||
|
||
if ($(target).is(':hidden')) { | ||
$(this).text($(this).data('showtext')); | ||
} | ||
else { | ||
$(this).text($(this).data('hidetext')); | ||
} | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
src/api/app/assets/javascripts/webui/obs_factory/bento/global-navigation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var position_menu = function(button_id, menu_id) { | ||
var top = $('#global-navigation').height()+1; | ||
var left = $('#' + button_id).offset().left; | ||
$('#' + menu_id).css({left:'',top:''}); | ||
$('#' + menu_id).offset({left:left,top:top}); | ||
}; | ||
|
||
$(function() { | ||
|
||
if (!global_navigation_data) return; | ||
|
||
var html = ''; | ||
|
||
$.each(global_navigation_data, function(i,menu){ | ||
html += '<ul class="global-navigation-menu" id="menu-' + menu.id + '">'; | ||
$.each(menu.items, function(j,submenu){ | ||
html += '<li><a href="' + submenu.link +'">'; | ||
html += '<span class="global-navigation-icon '+ submenu.image +'"></span>'; /*use imagemap and css */ | ||
html += '<span>' + submenu.title + '</span>'; | ||
html += '<span class="desc">' + submenu.desc + '</span>'; | ||
html += '</a></li>'; | ||
}); | ||
html += '</ul>'; | ||
}); | ||
|
||
$('#global-navigation').after(html); | ||
|
||
$('#global-navigation li[id^=item-]').click(function(){ | ||
var name = $(this).attr('id').substring(5); | ||
$("ul[id^=menu-]:visible").each(function() { | ||
$(this).fadeOut('fast'); | ||
} ); | ||
|
||
if( $(this).hasClass('selected') ) { | ||
$('#global-navigation li.selected').removeClass('selected'); | ||
} else { | ||
$('#global-navigation li.selected').removeClass('selected'); | ||
position_menu('item-' + name, 'menu-' + name); | ||
$('#menu-' + name).fadeIn(); | ||
$(this).addClass('selected'); | ||
} | ||
return false; | ||
}); | ||
|
||
$('.global-navigation-menu').mouseleave(function(){ | ||
$('#global-navigation li.selected').removeClass('selected'); | ||
$(this).fadeOut(); | ||
}); | ||
|
||
}); |
149 changes: 149 additions & 0 deletions
149
src/api/app/assets/javascripts/webui/obs_factory/bento/l10n/global-navigation-data-en_US.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
var global_navigation_data = [ | ||
{ | ||
"id": "downloads", | ||
"items": [ | ||
{ | ||
"link": "http://software.opensuse.org/", | ||
"image": "release-stable", | ||
"title": "Latest stable release", | ||
"desc": "Get the latest stable release of openSUSE" | ||
}, | ||
{ | ||
"link": "http://software.opensuse.org/developer/", | ||
"image": "release-devel", | ||
"title": "Latest development release", | ||
"desc": "Get the latest development release of openSUSE" | ||
}, | ||
{ | ||
"link": "http://software.opensuse.org/search", | ||
"image": "packages", | ||
"title": "Search for packages", | ||
"desc": "Get additional software from openSUSE Build Service" | ||
}, | ||
{ | ||
"link": "http://en.opensuse.org/Derivatives", | ||
"image": "derivatives", | ||
"title": "Derivatives", | ||
"desc": "Get one of the specialized distributions built on openSUSE" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "support", | ||
"items": [ | ||
{ | ||
"link": "http://en.opensuse.org/Portal:Support", | ||
"image": "help", | ||
"title": "Help", | ||
"desc": "Go to the Support Portal" | ||
}, | ||
{ | ||
"link": "http://doc.opensuse.org", | ||
"image": "development-documentation", | ||
"title": "Documentation", | ||
"desc": "Read guides and manuals" | ||
}, | ||
{ | ||
"link": "http://en.opensuse.org/", | ||
"image": "wiki", | ||
"title": "Wiki", | ||
"desc": "Read and write articles in our Wiki" | ||
}, | ||
{ | ||
"link": "http://tube.opensuse.org", | ||
"image": "video", | ||
"title": "Video", | ||
"desc": "Watch various tutorials, screencasts and recordings from talks and presentations" | ||
}, | ||
{ | ||
"link": "http://forums.opensuse.org/", | ||
"image": "forums", | ||
"title": "Forums", | ||
"desc": "Participate in our forums" | ||
}, | ||
{ | ||
"link": "http://en.opensuse.org/openSUSE:Mailing_lists", | ||
"image": "lists", | ||
"title": "Mailing lists", | ||
"desc": "Subscribe to mailinglists and look into their archives" | ||
}, | ||
{ | ||
"link": "http://en.opensuse.org/openSUSE:IRC_list", | ||
"image": "irc", | ||
"title": "IRC channels", | ||
"desc": "Communicate online using Internet Relay Chat" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "community", | ||
"items": [ | ||
{ | ||
"link": "http://connect.opensuse.org/", | ||
"image": "users", | ||
"title": "Connect", | ||
"desc": "Connect with your openSUSE friends" | ||
}, | ||
{ | ||
"link": "http://planet.opensuse.org/", | ||
"image": "planet", | ||
"title": "Planet", | ||
"desc": "See blogposts aggregated into one stream" | ||
}, | ||
{ | ||
"link": "http://news.opensuse.org/", | ||
"image": "news", | ||
"title": "News", | ||
"desc": "Latest announcements from the team" | ||
}, | ||
{ | ||
"link": "http://lizards.opensuse.org/", | ||
"image": "lizards", | ||
"title": "Lizards", | ||
"desc": "Users blog platform" | ||
}, | ||
{ | ||
"link": "http://shop.opensuse.org/", | ||
"image": "shop", | ||
"title": "Shop", | ||
"desc": "openSUSE gear here!" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "development", | ||
"items": | ||
[ | ||
{ | ||
"link": "http://en.opensuse.org/Portal:Development", | ||
"image": "developer", | ||
"title": "Developer documentation", | ||
"desc": "Centralized developer's documentation" | ||
}, | ||
{ | ||
"link": "http://features.opensuse.org/", | ||
"image": "features", | ||
"title": "Features", | ||
"desc": "Vote and work on upcoming openSUSE features" | ||
}, | ||
{ | ||
"link": "http://build.opensuse.org/", | ||
"image": "buildservice", | ||
"title": "Build Service", | ||
"desc": "Create, build and enhance packages" | ||
}, | ||
{ | ||
"link": "http://bugs.opensuse.org/", | ||
"image": "bugs", | ||
"title": "Bugs", | ||
"desc": "Report bugs using Bugzilla" | ||
}, | ||
{ | ||
"link": "http://susestudio.com", | ||
"image": "studio", | ||
"title": "SUSE Studio", | ||
"desc": "Create your own images using Studio" | ||
} | ||
] | ||
} | ||
]; |
Oops, something went wrong.