From f06f69b9da81337db14324783b45ea5f55fcf735 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Sun, 14 Dec 2014 19:01:59 -0600 Subject: Add theme type css class --- app/helpers/application_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 021bd0a494c..01aa4a60d4c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -114,6 +114,10 @@ module ApplicationHelper Gitlab::Theme.css_class_by_id(current_user.try(:theme_id)) end + def theme_type + Gitlab::Theme.type_css_class_by_id(current_user.try(:theme_id)) + end + def user_color_scheme_class COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user) end -- cgit v1.2.1 From 47634e392fab457dd0634225961944804bc04efe Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 23 Dec 2014 18:49:39 +0200 Subject: Refactor issues and merge requests lists Signed-off-by: Dmitriy Zaporozhets --- app/helpers/application_helper.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 01aa4a60d4c..90cc58f44b7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -275,4 +275,22 @@ module ApplicationHelper def promo_url 'https://' + promo_host end + + def page_filter_path(options={}) + exist_opts = { + state: params[:state], + scope: params[:scope], + label_name: params[:label_name], + milestone_id: params[:milestone_id], + assignee_id: params[:assignee_id], + author_id: params[:author_id], + sort: params[:sort], + } + + options = exist_opts.merge(options) + + path = request.path + path << "?#{options.to_param}" + path + end end -- cgit v1.2.1 From 84b40a346a46ca75e7a8981999c6b74187328435 Mon Sep 17 00:00:00 2001 From: Francesco Coda Zabetta Date: Mon, 15 Dec 2014 11:11:38 +0100 Subject: check browser version, blacklisting outdated IE (version < 10) --- app/helpers/application_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 90cc58f44b7..54caaa0f7e5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -293,4 +293,8 @@ module ApplicationHelper path << "?#{options.to_param}" path end + + def outdated_browser? + browser.ie? && browser.version.to_i < 10 + end end -- cgit v1.2.1 From 607ea7c6e5663542ae53de66a80f3e8beefe1341 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 30 Dec 2014 11:01:30 +0100 Subject: Share the key table between admin and profile resources. --- app/helpers/application_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 54caaa0f7e5..092a1ba9229 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -297,4 +297,12 @@ module ApplicationHelper def outdated_browser? browser.ie? && browser.version.to_i < 10 end + + def path_to_key(key, admin = false) + if admin + admin_user_key_path(@user, key) + else + profile_key_path(key) + end + end end -- cgit v1.2.1 From d02a22ba21f91d2aa4f9cf716dc3aefcf7e7495e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 Jan 2015 17:07:36 -0800 Subject: Redesign signin/singup pages --- app/helpers/application_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 092a1ba9229..f21b0bd1f50 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -305,4 +305,9 @@ module ApplicationHelper profile_key_path(key) end end + + def redirect_from_root? + request.env['rack.session']['user_return_to'] == + '/' + end end -- cgit v1.2.1 From bf079c24afb8ad2991a4eaf60a71a7bc45dd775d Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 3 Dec 2014 15:27:31 +0100 Subject: Replace highlight.js with rouge-fork rugments I decided to create a fork of rouge as rouge lacks a HTML formatter with the required options such as wrapping a line with tags. Furthermore I was not really convinced about the clarity of rouge's source code. Rugments 1.0.0beta3 for now only includes some basic linting and a new HTML formatter. Everything else should behave the same. --- app/helpers/application_helper.rb | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f21b0bd1f50..67c02f5dfa4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,8 +5,9 @@ module ApplicationHelper COLOR_SCHEMES = { 1 => 'white', 2 => 'dark', - 3 => 'solarized-dark', - 4 => 'monokai', + 3 => 'solarized-light', + 4 => 'solarized-dark', + 5 => 'monokai', } COLOR_SCHEMES.default = 'white' @@ -189,20 +190,6 @@ module ApplicationHelper BroadcastMessage.current end - def highlight_js(&block) - string = capture(&block) - - content_tag :div, class: "highlighted-data #{user_color_scheme_class}" do - content_tag :div, class: 'highlight' do - content_tag :pre do - content_tag :code do - string.html_safe - end - end - end - end - end - def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') capture_haml do haml_tag :time, date.to_s, -- cgit v1.2.1 From 41d7be3ce1ae9a4bff93b62322f35989b6ad4cf6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 16 Jan 2015 16:01:15 -0800 Subject: Allow to specify home page for non logged-in users --- app/helpers/application_helper.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 67c02f5dfa4..f65e04af205 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -292,9 +292,4 @@ module ApplicationHelper profile_key_path(key) end end - - def redirect_from_root? - request.env['rack.session']['user_return_to'] == - '/' - end end -- cgit v1.2.1 From 42bac7f9f27b0e8fb113e452fc2106882262172d Mon Sep 17 00:00:00 2001 From: Steven Thonus Date: Sat, 25 Jan 2014 18:15:44 +0100 Subject: adding avatar to project settings page added avatar removal show project avatar on dashboard, projects page, project page added rspec and feature tests added project avatar from repository new default project icon added added copying af avatar to forking of project added generated icon fixed avatar fork hound fix style fix test fix --- app/helpers/application_helper.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f65e04af205..772400d55ec 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -50,6 +50,31 @@ module ApplicationHelper args.any? { |v| v.to_s.downcase == action_name } end + def project_icon(project_id, options = {}) + project = Project.find_with_namespace(project_id) + if project.avatar.present? + image_tag project.avatar.url, options + elsif options[:only_uploaded] + image_tag '/assets/no_project_icon.png', options + elsif project.avatar_in_git + image_tag project_avatar_path(project), options + else # generated icon + project_identicon(project, options) + end + end + + def project_identicon(project, options = {}) + options[:class] ||= '' + options[:class] << ' identicon' + bg_color = Digest::MD5.hexdigest(project.name)[0, 6] + brightness = bg_color[0, 2].hex + bg_color[2, 2].hex + bg_color[4, 2].hex + text_color = (brightness > 375) ? '#000' : '#fff' + content_tag(:div, class: options[:class], + style: "background-color: ##{ bg_color }; color: #{ text_color }") do + project.name[0, 1].upcase + end + end + def group_icon(group_path) group = Group.find_by(path: group_path) if group && group.avatar.present? -- cgit v1.2.1 From 70c44a0da2bdeead90a99fe79e7c047d38b8ca5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Rosen=C3=B6gger?= <123haynes@gmail.com> Date: Mon, 19 Jan 2015 21:37:20 +0100 Subject: Fix tests, merge conflicts, some minor issues and make the project avatar feature mergable --- app/helpers/application_helper.rb | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 772400d55ec..32fd0ed7bcc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,10 +54,10 @@ module ApplicationHelper project = Project.find_with_namespace(project_id) if project.avatar.present? image_tag project.avatar.url, options - elsif options[:only_uploaded] - image_tag '/assets/no_project_icon.png', options elsif project.avatar_in_git image_tag project_avatar_path(project), options + elsif options[:only_uploaded] + image_tag '/assets/no_project_icon.png', options else # generated icon project_identicon(project, options) end @@ -107,24 +107,24 @@ module ApplicationHelper if project.repo_exists? time_ago_with_tooltip(project.repository.commit.committed_date) else - "Never" + 'Never' end rescue - "Never" + 'Never' end def grouped_options_refs repository = @project.repository options = [ - ["Branches", repository.branch_names], - ["Tags", VersionSorter.rsort(repository.tag_names)] + ['Branches', repository.branch_names], + ['Tags', VersionSorter.rsort(repository.tag_names)] ] # If reference is commit id - we should add it to branch/tag selectbox if(@ref && !options.flatten.include?(@ref) && @ref =~ /^[0-9a-zA-Z]{6,52}$/) - options << ["Commit", [@ref]] + options << ['Commit', [@ref]] end grouped_options_for_select(options, @ref || @project.default_branch) @@ -186,7 +186,7 @@ module ApplicationHelper path = controller.controller_path.split('/') namespace = path.first if path.second - [namespace, controller.controller_name, controller.action_name].compact.join(":") + [namespace, controller.controller_name, controller.action_name].compact.join(':') end # shortcut for gitlab config @@ -201,13 +201,13 @@ module ApplicationHelper def search_placeholder if @project && @project.persisted? - "Search in this project" + 'Search in this project' elsif @snippet || @snippets || @show_snippets 'Search snippets' elsif @group && @group.persisted? - "Search in this group" + 'Search in this group' else - "Search" + 'Search' end end @@ -218,7 +218,7 @@ module ApplicationHelper def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') capture_haml do haml_tag :time, date.to_s, - class: html_class, datetime: date.getutc.iso8601, title: date.stamp("Aug 21, 2011 9:23pm"), + class: html_class, datetime: date.getutc.iso8601, title: date.stamp('Aug 21, 2011 9:23pm'), data: { toggle: 'tooltip', placement: placement } haml_tag :script, "$('." + html_class + "').timeago().tooltip()" @@ -241,8 +241,8 @@ module ApplicationHelper end def spinner(text = nil, visible = false) - css_class = "loading" - css_class << " hide" unless visible + css_class = 'loading' + css_class << ' hide' unless visible content_tag :div, class: css_class do content_tag(:i, nil, class: 'fa fa-spinner fa-spin') + text @@ -259,17 +259,17 @@ module ApplicationHelper absolute_uri = nil end - # Add "nofollow" only to external links + # Add 'nofollow' only to external links if host && host != Gitlab.config.gitlab.host && absolute_uri if html_options if html_options[:rel] - html_options[:rel] << " nofollow" + html_options[:rel] << ' nofollow' else - html_options.merge!(rel: "nofollow") + html_options.merge!(rel: 'nofollow') end else html_options = Hash.new - html_options[:rel] = "nofollow" + html_options[:rel] = 'nofollow' end end -- cgit v1.2.1 From b92449c73e3b80a85144de08e0062c74cb37e80d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 24 Jan 2015 22:03:30 -0800 Subject: Predefine colors for project identicons --- app/helpers/application_helper.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 32fd0ed7bcc..f253ae91306 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -64,13 +64,22 @@ module ApplicationHelper end def project_identicon(project, options = {}) + allowed_colors = { + red: 'FFEBEE', + purple: 'F3E5F5', + indigo: 'E8EAF6', + blue: 'E3F2FD', + teal: 'E0F2F1', + orange: 'FBE9E7', + gray: 'EEEEEE' + } + options[:class] ||= '' options[:class] << ' identicon' - bg_color = Digest::MD5.hexdigest(project.name)[0, 6] - brightness = bg_color[0, 2].hex + bg_color[2, 2].hex + bg_color[4, 2].hex - text_color = (brightness > 375) ? '#000' : '#fff' + bg_key = project.id % 7 + content_tag(:div, class: options[:class], - style: "background-color: ##{ bg_color }; color: #{ text_color }") do + style: "background-color: ##{ allowed_colors.values[bg_key] }; color: #555") do project.name[0, 1].upcase end end -- cgit v1.2.1 From 3588a07b8379c98029598cac8050a1f90fd9c354 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 24 Jan 2015 23:08:52 -0800 Subject: Remove default project icon --- app/helpers/application_helper.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f253ae91306..104ae517a08 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -56,8 +56,6 @@ module ApplicationHelper image_tag project.avatar.url, options elsif project.avatar_in_git image_tag project_avatar_path(project), options - elsif options[:only_uploaded] - image_tag '/assets/no_project_icon.png', options else # generated icon project_identicon(project, options) end -- cgit v1.2.1 From fe831dcd6f4af535abba1a9dc350c4d8a0f809e9 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 28 Jan 2015 03:30:27 -0500 Subject: Move `spinner` helper into IconsHelper Also updates it to use the new `icon` method. --- app/helpers/application_helper.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 104ae517a08..d00f1aac2d6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -247,15 +247,6 @@ module ApplicationHelper Gitlab::MarkdownHelper.gitlab_markdown?(filename) end - def spinner(text = nil, visible = false) - css_class = 'loading' - css_class << ' hide' unless visible - - content_tag :div, class: css_class do - content_tag(:i, nil, class: 'fa fa-spinner fa-spin') + text - end - end - def link_to(name = nil, options = nil, html_options = nil, &block) begin uri = URI(options) -- cgit v1.2.1 From cc39bca3fa71930421f1c46844b4d02d5ff93e8b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 2 Feb 2015 21:15:44 -0800 Subject: Rubocop: Style/AlignHash enabled --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d00f1aac2d6..7417261a847 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,9 +75,9 @@ module ApplicationHelper options[:class] ||= '' options[:class] << ' identicon' bg_key = project.id % 7 + style = "background-color: ##{ allowed_colors.values[bg_key] }; color: #555" - content_tag(:div, class: options[:class], - style: "background-color: ##{ allowed_colors.values[bg_key] }; color: #555") do + content_tag(:div, class: options[:class], style: style) do project.name[0, 1].upcase end end -- cgit v1.2.1 From 61cc6a9244f316f684cd887febd9dae1030a04b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 2 Feb 2015 21:59:28 -0800 Subject: Rubocop: indentation fixes Yay!!! --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7417261a847..1fbb44ee442 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -78,7 +78,7 @@ module ApplicationHelper style = "background-color: ##{ allowed_colors.values[bg_key] }; color: #555" content_tag(:div, class: options[:class], style: style) do - project.name[0, 1].upcase + project.name[0, 1].upcase end end -- cgit v1.2.1 From 254a63dcf7dcfe824eb0b7227e2cd63fac027f85 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 3 Feb 2015 13:11:33 -0800 Subject: Improve collapsing sidebar --- app/helpers/application_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1fbb44ee442..e45f4650309 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -315,4 +315,12 @@ module ApplicationHelper profile_key_path(key) end end + + def nav_sidebar_class + if nav_menu_collapsed? + "page-sidebar-collapsed" + else + "page-sidebar-expanded" + end + end end -- cgit v1.2.1 From 76aad9b76ed756ca9ba2cbcdb399c815e542b3ae Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sat, 24 Jan 2015 11:02:58 -0700 Subject: Upgrade to Rails 4.1.9 Make the following changes to deal with new behavior in Rails 4.1.2: * Use nested resources to avoid slashes in arguments to path helpers. --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e45f4650309..c3c77d9880f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,7 +55,7 @@ module ApplicationHelper if project.avatar.present? image_tag project.avatar.url, options elsif project.avatar_in_git - image_tag project_avatar_path(project), options + image_tag namespace_project_avatar_path(project.namespace, project), options else # generated icon project_identicon(project, options) end -- cgit v1.2.1 From a8a328b1513c0aa442faaf8e8dd6f06f86ac3211 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 18 Feb 2015 00:16:42 -0800 Subject: DB performance improvements to GitLab --- app/helpers/application_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e45f4650309..f65c5335a62 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,13 @@ module ApplicationHelper end def project_icon(project_id, options = {}) - project = Project.find_with_namespace(project_id) + project = + if project_id.is_a?(Project) + project = project_id + else + Project.find_with_namespace(project_id) + end + if project.avatar.present? image_tag project.avatar.url, options elsif project.avatar_in_git -- cgit v1.2.1