From 53808b073f539ba2b442738b6abf97228488e311 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 8 Apr 2014 09:12:37 +0200 Subject: moving all of core into toplevel, tests fail. --- core/app/assets/javascripts/leap.js | 7 -- core/app/assets/javascripts/platform.js | 93 ---------------------- core/app/helpers/core_helper.rb | 13 --- core/app/helpers/download_helper.rb | 33 -------- core/app/helpers/navigation_helper.rb | 82 ------------------- core/app/views/common/_download_for_os.html.haml | 17 ---- core/app/views/common/_home_page_buttons.html.haml | 23 ------ core/app/views/kaminari/_first_page.html.haml | 9 --- core/app/views/kaminari/_gap.html.haml | 8 -- core/app/views/kaminari/_last_page.html.haml | 9 --- core/app/views/kaminari/_next_page.html.haml | 12 --- core/app/views/kaminari/_page.html.haml | 14 ---- core/app/views/kaminari/_paginator.html.haml | 19 ----- core/app/views/kaminari/_prev_page.html.haml | 12 --- 14 files changed, 351 deletions(-) delete mode 100644 core/app/assets/javascripts/leap.js delete mode 100644 core/app/assets/javascripts/platform.js delete mode 100644 core/app/helpers/core_helper.rb delete mode 100644 core/app/helpers/download_helper.rb delete mode 100644 core/app/helpers/navigation_helper.rb delete mode 100644 core/app/views/common/_download_for_os.html.haml delete mode 100644 core/app/views/common/_home_page_buttons.html.haml delete mode 100644 core/app/views/kaminari/_first_page.html.haml delete mode 100644 core/app/views/kaminari/_gap.html.haml delete mode 100644 core/app/views/kaminari/_last_page.html.haml delete mode 100644 core/app/views/kaminari/_next_page.html.haml delete mode 100644 core/app/views/kaminari/_page.html.haml delete mode 100644 core/app/views/kaminari/_paginator.html.haml delete mode 100644 core/app/views/kaminari/_prev_page.html.haml (limited to 'core/app') diff --git a/core/app/assets/javascripts/leap.js b/core/app/assets/javascripts/leap.js deleted file mode 100644 index 94e602d..0000000 --- a/core/app/assets/javascripts/leap.js +++ /dev/null @@ -1,7 +0,0 @@ - -// -// add a bootstrap alert to the page via javascript. -// -function alert_message(msg) { - $('#messages').append('
×'+msg+'
'); -} diff --git a/core/app/assets/javascripts/platform.js b/core/app/assets/javascripts/platform.js deleted file mode 100644 index 108c162..0000000 --- a/core/app/assets/javascripts/platform.js +++ /dev/null @@ -1,93 +0,0 @@ -/* Inspired by mozillas platform detection: - https://github.com/mozilla/bedrock/tree/master/media/js/base -*/ - (function () { - 'use strict'; - function getPlatform() { - var ua = navigator.userAgent, - pf = navigator.platform; - if (/Win(16|9[x58]|NT( [1234]| 5\.0| [^0-9]|[^ -]|$))/.test(ua) || - /Windows ([MC]E|9[x58]|3\.1|4\.10|NT( [1234]| 5\.0| [^0-9]|[^ ]|$))/.test(ua) || - /Windows_95/.test(ua)) { - /** - * Officially unsupported platforms are Windows 95, 98, ME, NT 4.x, 2000 - * These regular expressions match: - * - Win16 - * - Win9x - * - Win95 - * - Win98 - * - WinNT (not followed by version or followed by version <= 5) - * - Windows ME - * - Windows CE - * - Windows 9x - * - Windows 95 - * - Windows 98 - * - Windows 3.1 - * - Windows 4.10 - * - Windows NT (not followed by version or followed by version <= 5) - * - Windows_95 - */ - return 'oldwin'; - } - if (ua.indexOf("MSIE 6.0") !== -1 && - ua.indexOf("Windows NT 5.1") !== -1 && - ua.indexOf("SV1") === -1) { - // Windows XP SP1 - return 'oldwin'; - } - if (pf.indexOf("Win32") !== -1 || - pf.indexOf("Win64") !== -1) { - return 'windows'; - } - if (/android/i.test(ua)) { - return 'android'; - } - if (/armv[6-7]l/.test(pf)) { - return 'android'; - } - if (pf.indexOf("Linux") !== -1) { - return 'linux'; - //if (pf.indexOf("64") !== -1) { - // return 'linux64'; - //} else { - // return 'linux32'; - //} - } - if (pf.indexOf("MacPPC") !== -1) { - return 'oldmac'; - } - if (/Mac OS X 10.[0-5]/.test(ua)) { - return 'oldmac'; - } - if (pf.indexOf('iPhone') !== -1 || - pf.indexOf('iPad') !== -1 || - pf.indexOf('iPod') !== -1 ) { - return 'ios'; - } - if (ua.indexOf("Mac OS X") !== -1) { - return 'osx'; - } - if (ua.indexOf("MSIE 5.2") !== -1) { - return 'oldmac'; - } - if (pf.indexOf("Mac") !== -1) { - return 'oldmac'; - } - if (navigator.platform === '' && - navigator.userAgent.indexOf("Firefox") !== -1 && - navigator.userAgent.indexOf("Mobile") !== -1) { - return 'fxos'; - } - - return 'other'; - } - (function () { - // Immediately set the platform classname on the html-element - // to avoid lots of flickering - var h = document.documentElement; - window.site = { - platform : getPlatform() - }; - h.className = window.site.platform; - })(); - })(); diff --git a/core/app/helpers/core_helper.rb b/core/app/helpers/core_helper.rb deleted file mode 100644 index a6c7479..0000000 --- a/core/app/helpers/core_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -# -# Misc. helpers needed throughout. -# -module CoreHelper - - # - # insert common buttons (download, login, etc) - # - def home_page_buttons(on_user_page = false) - render 'common/home_page_buttons', {:on_user_page => on_user_page} - end - -end diff --git a/core/app/helpers/download_helper.rb b/core/app/helpers/download_helper.rb deleted file mode 100644 index ee0fe73..0000000 --- a/core/app/helpers/download_helper.rb +++ /dev/null @@ -1,33 +0,0 @@ -module DownloadHelper - - def alternative_client_links(os = nil) - alternative_clients(os).map do |client| - link_to(I18n.t("os."+client), client_download_url(client)) - end - end - - def alternative_clients(os = nil) - available_clients - [os] - end - - def client_download_url(os = nil) - client_download_domain + client_download_path(os) - end - - def client_download_path(os) - download_paths[os.to_s] || download_paths['other'] || '' - end - - def available_clients - APP_CONFIG[:available_clients] || [] - end - - def client_download_domain - APP_CONFIG[:client_download_domain] || '' - end - - def download_paths - APP_CONFIG[:download_paths] || {} - end - -end diff --git a/core/app/helpers/navigation_helper.rb b/core/app/helpers/navigation_helper.rb deleted file mode 100644 index 19cb934..0000000 --- a/core/app/helpers/navigation_helper.rb +++ /dev/null @@ -1,82 +0,0 @@ -module NavigationHelper - - # - # used to create a side navigation link. - # - # Signature is the same as link_to, except it accepts an :active value in the html_options - # - def link_to_navigation(*args) - if args.last.is_a? Hash - html_options = args.pop.dup - active_class = html_options.delete(:active) ? 'active' : nil - html_options[:class] = [html_options[:class], active_class].join(' ') - args << html_options - else - active_class = nil - end - content_tag :li, :class => active_class do - link_to(*args) - end - end - - # - # returns true if params[:action] matches one of the args. - # - def action?(*actions) - actions.detect do |action| - if action.is_a? String - action == action_string - elsif action.is_a? Symbol - if action == :none - action_string == nil - else - action == action_symbol - end - end - end - end - - # - # returns true if params[:controller] matches one of the args. - # - # for example: - # controller?(:me, :home) - # controller?('groups/') <-- matches any controller in namespace 'groups' - # - def controller?(*controllers) - controllers.each do |cntr| - if cntr.is_a? String - if cntr.ends_with?('/') - return true if controller_string.starts_with?(cntr.chop) - end - return true if cntr == controller_string - elsif cntr.is_a? Symbol - return true if cntr == controller_symbol - end - end - return false - end - - private - - def controller_string - @controller_string ||= params[:controller].to_s.gsub(/^\//, '') - end - - def controller_symbol - @controller_symbol ||= params[:controller].gsub(/^\//,'').gsub('/','_').to_sym - end - - def action_string - params[:action] - end - - def action_symbol - @action_symbol ||= if params[:action].present? - params[:action].to_sym - else - nil - end - end - -end diff --git a/core/app/views/common/_download_for_os.html.haml b/core/app/views/common/_download_for_os.html.haml deleted file mode 100644 index 3a11d10..0000000 --- a/core/app/views/common/_download_for_os.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- os = download_for_os -%div{:class => "os-#{os}"} - %span.link - - btn_class = (os == "other") ? "disabled" : "btn-primary" - = link_to client_download_url(os), :class => "btn btn-large #{btn_class}" do - = big_icon('download') - .pull-right - = t(:download_client) - %br/ - %small= I18n.t("os.#{os}") - %span.info - %div= t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe - %div - - if os == "other" - = t(:all_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe - - else - = t(:other_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml deleted file mode 100644 index c9ea7a2..0000000 --- a/core/app/views/common/_home_page_buttons.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- icon_color = :black - -.home-buttons - .row-fluid.first - .span2 - .download.span8 - = render partial: 'common/download_for_os', collection: available_clients + ['other'] - .span2 - - if local_assigns[:divider] - .row-fluid - .span12 - = render local_assigns[:divider] - - if !local_assigns[:on_user_page] - .row-fluid.second - .login.span4 - %span.link= link_to(icon('ok-sign', icon_color) + t(:login), login_path, :class => 'btn') - %span.info= t(:login_info) - .signup.span4 - %span.link= link_to(icon('user', icon_color) + t(:signup), signup_path, :class => 'btn') - %span.info= t(:signup_info) - .help.span4 - %span.link= link_to(icon('question-sign', icon_color) + t(:get_help), new_ticket_path, :class => 'btn') - %span.info= t(:help_info) diff --git a/core/app/views/kaminari/_first_page.html.haml b/core/app/views/kaminari/_first_page.html.haml deleted file mode 100644 index 34436e3..0000000 --- a/core/app/views/kaminari/_first_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "First" page --# available local variables --# url: url to the first page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li - = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote diff --git a/core/app/views/kaminari/_gap.html.haml b/core/app/views/kaminari/_gap.html.haml deleted file mode 100644 index 51de678..0000000 --- a/core/app/views/kaminari/_gap.html.haml +++ /dev/null @@ -1,8 +0,0 @@ --# Non-link tag that stands for skipped pages... --# available local variables --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.disabled - = raw(t 'views.pagination.truncate') diff --git a/core/app/views/kaminari/_last_page.html.haml b/core/app/views/kaminari/_last_page.html.haml deleted file mode 100644 index c90433c..0000000 --- a/core/app/views/kaminari/_last_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Last" page --# available local variables --# url: url to the last page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} diff --git a/core/app/views/kaminari/_next_page.html.haml b/core/app/views/kaminari/_next_page.html.haml deleted file mode 100644 index ea6cab2..0000000 --- a/core/app/views/kaminari/_next_page.html.haml +++ /dev/null @@ -1,12 +0,0 @@ --# Link to the "Next" page --# available local variables --# url: url to the next page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -- if current_page.last? - %li.disabled - %span= raw(t 'views.pagination.next') -- else - %li= link_to(raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote) diff --git a/core/app/views/kaminari/_page.html.haml b/core/app/views/kaminari/_page.html.haml deleted file mode 100644 index 2f2f142..0000000 --- a/core/app/views/kaminari/_page.html.haml +++ /dev/null @@ -1,14 +0,0 @@ --# Link showing page number --# available local variables --# page: a page object for "this" page --# url: url to this page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote - -- if page.current? - %li.active - %span= page -- else - %li= link_to(page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}) diff --git a/core/app/views/kaminari/_paginator.html.haml b/core/app/views/kaminari/_paginator.html.haml deleted file mode 100644 index 79c5b92..0000000 --- a/core/app/views/kaminari/_paginator.html.haml +++ /dev/null @@ -1,19 +0,0 @@ --# The container tag --# available local variables --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote --# paginator: the paginator that renders the pagination tags inside -= paginator.render do - .pagination - %ul - -#= first_page_tag unless current_page.first? - = prev_page_tag #unless current_page.first? - - each_page do |page| - - if page.left_outer? || page.right_outer? || page.inside_window? - = page_tag page - - elsif !page.was_truncated? - = gap_tag - = next_page_tag #unless current_page.last? - -#= last_page_tag unless current_page.last? diff --git a/core/app/views/kaminari/_prev_page.html.haml b/core/app/views/kaminari/_prev_page.html.haml deleted file mode 100644 index d274bf4..0000000 --- a/core/app/views/kaminari/_prev_page.html.haml +++ /dev/null @@ -1,12 +0,0 @@ --# Link to the "Previous" page --# available local variables --# url: url to the previous page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -- if current_page.first? - %li.disabled - %span= raw(t 'views.pagination.previous') -- else - %li= link_to(raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote) -- cgit v1.2.3