Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cibernox/pinkmine
base: 44b32e92e4
...
head fork: cibernox/pinkmine
compare: e144119988
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 12 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 08, 2012
miguel.camba Helpers extracted 41e3306
Commits on May 10, 2012
miguel.camba Breadcrumb helper 91f5ef6
miguel.camba Merge branch 'master' of github.com:cibernox/pinkmine
Conflicts:
	app/helpers/application_helper.rb
	app/helpers/issues_helper.rb
	app/views/projects/show.html.haml
	spec/helpers/issues_helper_spec.rb
e144119
View
BIN  app/assets/images/thoughtbot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
7 app/assets/stylesheets/common.css.scss
@@ -1,3 +1,6 @@
+/* Variables */
+$btnBackgroundHighlight: #E6E6E6;
+
/* Espaciado */
.margin-1em {
margin-top: 1em;
@@ -15,4 +18,8 @@
}
.text-right {
text-align: right;
+}
+/* Colors */
+ul.dropdown-menu a.active{
+ background-color: $btnBackgroundHighlight;
}
View
27 app/helpers/application_helper.rb
@@ -1,11 +1,11 @@
# -*- encoding : utf-8 -*-
module ApplicationHelper
- # Sobreescribo link_to para que acepte opciones útiles.
+ # Override link_to so it can accept some useful options
#
- # icon: Genera un enlace con icono al estilo de twitter-bootstrap
- # Ejemplo:
- # link_to 'Mi cuenta', '#', icon: 'user' # => <a href="#"><i class="icon-user"></i>Mi cuenta</a>
+ # icon: Generates a link with a bootstrap-style icon
+ # Example:
+ # link_to 'Profile', '#', icon: 'user' # => <a href="#"><i class="icon-user"></i>Profile</a>
#
def link_to(body, url, html_options = {})
if (icon_class = html_options.delete(:icon))
@@ -28,7 +28,7 @@ def default_text_for_bootstrap_alert(level)
text.html_safe
end
- # Renderiza un alert estilado para bootstrap, con boton de cerrar.
+ # Renders a bootstrap-styled alert with close button and fade in effect.
def bootstrap_alert(text = nil, level = nil)
text ||= default_text_for_bootstrap_alert(level)
content_tag :div, class: "alert fade in #{flash_class(level)}" do
@@ -36,14 +36,14 @@ def bootstrap_alert(text = nil, level = nil)
end
end
- # Renderiza los flashes (:notice, :error, :success ...) con estilo de alerts de bootstrap
+ # Renders the flashes (:notice, :error, :success ...) on the bootstrap way.
def bootstrap_flashes
[:notice, :error, :alert, :success].map do |level|
bootstrap_alert(flash[level], level) unless flash[level].blank?
end.join.html_safe
end
- # Dado un tipo de mensaje flash, devuelve la clase del alert de bootstrap correspondiente
+ # Given a message type, return the bootrtrap's class for this king of alert
def flash_class(level)
case level.to_sym
when :notice then "alert-info"
@@ -53,4 +53,17 @@ def flash_class(level)
end
end
+ # Renders a bootstrap breadcrumbs for any number of links
+ def bootstrap_breadcrumb(*links)
+ content_tag :ul, class: 'breadcrumb' do
+ links.each_with_index.map do |link, index|
+ content_tag :li, class: ('active' if index == links.size - 1) do
+ content = link
+ content << (index < links.size - 1 ? content_tag(:span, '/', class: 'divider') : '')
+ content.html_safe
+ end
+ end.join.html_safe
+ end
+ end
+
end
View
13 app/helpers/issues_helper.rb
@@ -34,4 +34,17 @@ def issue_priority_label(issue)
content_tag(:span, issue.priority, class: "label #{color_class}")
end
+ # Generates a dropdown button for select the status of the given issue
+ def issue_status_dropdown(issue)
+ link_content = issue.status + content_tag(:span, nil, class: 'caret')
+ content_tag :div, class: 'btn-group' do
+ link_to(link_content.html_safe, '#', class: 'btn btn-small dropdown-toggle', data: { toggle: "dropdown"} ) +
+ content_tag(:ul, class: 'dropdown-menu') do
+ Issue::VALID_STATUS.map do |status|
+ link_to status, '#', class: ('active' if status == issue.status), data: { status: status }
+ end.join.html_safe
+ end
+ end
+ end
+
end
View
14 app/views/issues/show.html.haml
@@ -1,15 +1,5 @@
.row-fluid
.span12
- %ul.breadcrumb
- %li
- = link_to 'Home', root_path
- %span.divider /
- %li
- = link_to 'Projects', projects_path
- %span.divider /
- %li
- = link_to project.name, project
- %span.divider /
- %li.active
- = link_to "# #{issue.code} - #{issue.title}", '#'
+ = bootstrap_breadcrumb link_to('Home', root_path), link_to('Projects', projects_path),
+ link_to(project.name, '#'), link_to("# #{issue.code} - #{issue.title}", '#')
%p Bla bla esta issue bla bla
View
4 app/views/layouts/application.html.haml
@@ -10,13 +10,13 @@
.navbar.navbar-fixed-top
.navbar-inner
.container-fluid
- %a.btn.btn-navbar{ 'data-toggle' => 'collapse', 'data-target' => '.nav-collapse' }
+ %a.btn.btn-navbar{ data: { toggle: 'collapse', target: '.nav-collapse' } }
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to 'Pinkmine', root_url, class: 'brand'
.btn-group.pull-right
- %a.btn.dropdown-toggle{ 'data-toggle' => 'dropdown', href: "#" }
+ %a.btn.dropdown-toggle{ href: "#", data: { toggle: 'dropdown' } }
%i.icon-home= " #{current_user ? current_user.username : 'Username'}"
%span.caret
%ul.dropdown-menu
View
9 app/views/projects/index.html.haml
@@ -1,11 +1,6 @@
.row-fluid
.span12
- %ul.breadcrumb
- %li
- = link_to 'Home', root_path
- %span.divider /
- %li.active
- = link_to 'Projects', projects_path
+ = bootstrap_breadcrumb link_to('Home', root_path), link_to('Projects', projects_path)
.row-fluid
.span2
.sidebar-nav.well
@@ -17,7 +12,7 @@
%ul.thumbnails
%li.span2= link_to image_tag('la_o.png'), projects.first, class: 'thumbnail'
%li.span2= link_to image_tag('t.png'), '#', class: 'thumbnail'
- %li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
+ %li.span2= link_to image_tag('thoughtbot.png'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
View
29 app/views/projects/show.html.haml
@@ -1,14 +1,8 @@
.row-fluid
.span12
- %ul.breadcrumb
- %li
- = link_to 'Home', root_path
- %span.divider /
- %li
- = link_to 'Projects', projects_path
- %span.divider /
- %li.active
- = link_to project.name, '#'
+ = bootstrap_breadcrumb link_to('Home', root_path), link_to('Projects', projects_path), link_to(project.name, '#')
+ .well
+ Opciones de búsqueda
.row-fluid
.span2
.sidebar-nav.well
@@ -17,7 +11,8 @@
%li= link_to 'Estadísticas', '#personal', icon: 'book'
%li= link_to 'Settings', '#associations', icon: 'home'
.span10
- %table.table.table-bordered.table-striped
+
+ %table.table.table-bordered.table-striped.table-condensed
%thead
%tr
%th #
@@ -27,23 +22,13 @@
%th Description
%th Assigned
%th Progress
- / %th Updated at
%tbody
- project.issues.each do |issue|
%tr
%td= link_to issue.code, [project, issue]
- %td
- .btn-group
- %a.btn.btn-small.dropdown-toggle{ href: '#', data: { toggle: 'dropdown' } }
- = issue.status
- %span.caret
- %ul.dropdown-menu
- = link_to 'Started', '#'
- = link_to 'Done', '#'
- = link_to 'Feedback', '#'
+ %td= issue_status_dropdown(issue)
%td= issue_priority_label(issue)
%td= link_to issue.title, [project, issue]
%td= truncate(issue.description, length: 50)
%td= link_to issue.responsable, issue.responsable if issue.responsable
- %td= issue_progress_bar(issue)
- / %td= issue.updated_at.strftime '%d/%m/%y %H:%M'
+ %td= issue_progress_bar(issue)
View
2  app/views/sessions/_login_error.html.haml
@@ -1,4 +1,4 @@
- text ||= "Usuario o password incorrecto"
.alert.alert-error.fade.in.text-center
- %button.close{ 'data-dismiss' => 'alert' } ×
+ %a.close{ href: "#", data: { dismiss: 'alert' } }×
= text
View
2  app/views/users/my_profile.html.haml
@@ -1,7 +1,7 @@
/ Template de alerts
%script#alertTemplate{ type: "text/template" }
.alert{ class: "{{klass}}"}
- %a.close{ 'data-dismiss' => 'alert', href: "#"
+ %a.close{ href: "#", data: { dismiss: 'alert' }
{{text}}
/ Contenido estático
View
11 spec/helpers/application_helper_spec.rb
@@ -55,4 +55,15 @@
end
end
+ describe '#bootstrap_breadcrumb' do
+ it "should render a breadcrumb for the given links" do
+ bootstrap_breadcrumb('a', 'b', 'c', 'd').should have_tag('ul.breadcrumb') do
+ with_tag('li', count: 4)
+ with_tag('li.active')
+ with_tag('span.divider', count: 3)
+ with_tag('span.divider', count: 3)
+ end
+ end
+ end
+
end
View
16 spec/helpers/issues_helper_spec.rb
@@ -32,6 +32,22 @@
end
end
+ describe '#issue_status_dropdown' do
+ it 'should return a dropdown button for select the status of an issue, with an option for each status' do
+ issue = Issue.new status: "in_progress"
+ dropdown = issue_status_dropdown(issue)
+ dropdown.should have_tag('.btn-group') do
+ with_tag('a.btn.dropdown-toggle')
+ with_tag('ul.dropdown-menu')
+ # As many links as possible status
+ with_tag('.dropdown-menu a', count: Issue::VALID_STATUS.size)
+ # Only the one of the current status is active
+ with_tag('.dropdown-menu a.active', count: 1)
+ with_tag('.dropdown-menu a.active[data-status=in_progress]')
+ end
+ end
+ end
+
describe '#issue_priority_label' do
it 'should return a label with the appropiate style for each priority' do
# Low: gray

No commit comments for this range

Something went wrong with that request. Please try again.