mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
fix #1256 by changing the layout of the context view to match the project view
This commit is contained in:
parent
f9232a7e9d
commit
dea8734498
9 changed files with 57 additions and 63 deletions
|
@ -120,18 +120,6 @@ module ApplicationHelper
|
||||||
link_to( descriptor, project, :title => "View project: #{project.name}" )
|
link_to( descriptor, project, :title => "View project: #{project.name}" )
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
|
||||||
link_to(descriptor,
|
|
||||||
url_for({:controller => 'projects', :action => 'edit', :id => project.id}),
|
|
||||||
{:id => "link_edit_#{dom_id(project)}", :class => "project_edit_settings icon"})
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_to_edit_context (context, descriptor = sanitize(context.name))
|
|
||||||
link_to(descriptor,
|
|
||||||
url_for({:controller => 'contexts', :action => 'edit', :id => context.id}),
|
|
||||||
{:id => "link_edit_#{dom_id(context)}", :class => "context_edit_settings"})
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_to_edit_note (note, descriptor = sanitize(note.id.to_s))
|
def link_to_edit_note (note, descriptor = sanitize(note.id.to_s))
|
||||||
link_to(descriptor,
|
link_to(descriptor,
|
||||||
url_for({:controller => 'notes', :action => 'edit', :id => note.id}),
|
url_for({:controller => 'notes', :action => 'edit', :id => note.id}),
|
||||||
|
|
|
@ -1,30 +1,38 @@
|
||||||
module ContextsHelper
|
module ContextsHelper
|
||||||
|
|
||||||
|
def get_listing_sortable_options
|
||||||
|
{
|
||||||
|
:tag => 'div',
|
||||||
|
:handle => 'handle',
|
||||||
|
:complete => visual_effect(:highlight, 'list-contexts'),
|
||||||
|
:url => order_contexts_path
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_to_delete_context(context, descriptor = sanitize(context.name))
|
||||||
|
link_to(descriptor,
|
||||||
|
context_path(context, :format => 'js'),
|
||||||
|
{
|
||||||
|
:id => "delete_context_#{context.id}",
|
||||||
|
:class => "delete_context_button icon",
|
||||||
|
:x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name),
|
||||||
|
:title => t('contexts.delete_context_title')
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
def get_listing_sortable_options
|
def link_to_edit_context (context, descriptor = sanitize(context.name))
|
||||||
{
|
link_to(descriptor,
|
||||||
:tag => 'div',
|
url_for({:controller => 'contexts', :action => 'edit', :id => context.id}),
|
||||||
:handle => 'handle',
|
{
|
||||||
:complete => visual_effect(:highlight, 'list-contexts'),
|
:id => "link_edit_#{dom_id(context)}",
|
||||||
:url => order_contexts_path
|
:class => "context_edit_settings icon"
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_delete_context(context, descriptor = sanitize(context.name))
|
|
||||||
link_to(
|
def summary(context, undone_todo_count)
|
||||||
descriptor,
|
content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.")
|
||||||
context_path(context, :format => 'js'),
|
end
|
||||||
{
|
|
||||||
:id => "delete_context_#{context.id}",
|
|
||||||
:class => "delete_context_button",
|
|
||||||
:x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name),
|
|
||||||
:title => t('contexts.delete_context_title')
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def summary(context, undone_todo_count)
|
|
||||||
content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,6 +58,15 @@ module ProjectsHelper
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
||||||
|
link_to(descriptor,
|
||||||
|
url_for({:controller => 'projects', :action => 'edit', :id => project.id}),
|
||||||
|
{
|
||||||
|
:id => "link_edit_#{dom_id(project)}",
|
||||||
|
:class => "project_edit_settings icon"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
def summary(project)
|
def summary(project)
|
||||||
project_description = ''
|
project_description = ''
|
||||||
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
||||||
|
|
|
@ -1,29 +1,17 @@
|
||||||
<% context = context_listing
|
<%
|
||||||
|
context = context_listing
|
||||||
suppress_drag_handle ||= false
|
suppress_drag_handle ||= false
|
||||||
suppress_edit_button ||= false
|
suppress_edit_button ||= false
|
||||||
|
suppress_delete_button ||= false
|
||||||
%>
|
%>
|
||||||
<div id="<%= dom_id(context, "container") %>" class="list">
|
<div id="<%= dom_id(context, "container") %>" class="list">
|
||||||
<div id="<%= dom_id(context) %>" class="context sortable_row" style="display:'';">
|
<div id="<%= dom_id(context) %>" class="context sortable_row" style="display:block">
|
||||||
<% unless suppress_drag_handle -%>
|
<%= suppress_delete_button ? "" : link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) -%>
|
||||||
<div class="position">
|
<%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) -%>
|
||||||
<span class="handle"><%= t('common.drag_handle') %></span>
|
<%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip')-%>
|
||||||
</div>
|
<div class="context_description">
|
||||||
<% end -%>
|
|
||||||
<div class="data">
|
|
||||||
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
|
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
|
||||||
<% if context.hide? %>
|
|
||||||
<span class="grey"><%= t('states.hidden') %></span>
|
|
||||||
<% else %>
|
|
||||||
<span class="grey"><%= t('states.visible') %></span>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) %>
|
|
||||||
<%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="<%= dom_id(context, 'edit') %>" class="edit-form" style="display:none;">
|
<div id="<%= dom_id(context, 'edit') %>" class="edit-form" style="display:none;">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
<span id="<%= state %>-contexts-count" class="badge"><%= context_state_group.length %></span>
|
<span id="<%= state %>-contexts-count" class="badge"><%= context_state_group.length %></span>
|
||||||
<%= t("states."+ state +"_plural")%> <%= t('common.contexts') %>
|
<%= t("states."+ state +"_plural")%> <%= t('common.contexts') %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div id="<%= state%>-contexts-empty-nd" style="<%= no_contexts ? 'display:block' : 'display:none'%>">
|
<div id="<%= state%>-contexts-empty-nd" style="<%= no_contexts ? 'display:block' : 'display:none'%>">
|
||||||
<div class="message"><p><%= t('contexts.no_contexts_' + state) %></p></div>
|
<div class="message"><p><%= t('contexts.no_contexts_' + state) %></p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="list-contexts-<%= state %>">
|
<div id="list-contexts-<%= state %>">
|
||||||
<%= render :partial => 'context_listing', :collection => context_state_group %>
|
<%= render :partial => 'context_listing', :collection => context_state_group %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,9 +8,7 @@ suppress_delete_button ||= false
|
||||||
<div id="<%= dom_id(project) %>" class="project sortable_row" style="display:block">
|
<div id="<%= dom_id(project) %>" class="project sortable_row" style="display:block">
|
||||||
<%= suppress_delete_button ? "" : link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project_title'), :class=>"delete_item")) %>
|
<%= suppress_delete_button ? "" : link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project_title'), :class=>"delete_item")) %>
|
||||||
<%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
|
<%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
|
||||||
<%= image_tag('grip.png',
|
<%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip') -%>
|
||||||
:width => '7', :height => '16', :border => '0',
|
|
||||||
:title => t('common.drag_handle'), :class => 'grip') unless suppress_drag_handle -%>
|
|
||||||
<div class="project_description">
|
<div class="project_description">
|
||||||
<span class="<%= needsreview_class( project ) %>">
|
<span class="<%= needsreview_class( project ) %>">
|
||||||
<%= link_to_project( project ) %>
|
<%= link_to_project( project ) %>
|
||||||
|
|
|
@ -44,7 +44,7 @@ When /^I drag context "([^"]*)" above context "([^"]*)"$/ do |context_drag, cont
|
||||||
drag_index = context_list_find_index(context_drag)
|
drag_index = context_list_find_index(context_drag)
|
||||||
drop_index = context_list_find_index(context_drop)
|
drop_index = context_list_find_index(context_drop)
|
||||||
|
|
||||||
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.handle'});"
|
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});"
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
|
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
|
||||||
|
|
|
@ -891,7 +891,7 @@ var ContextListPage = {
|
||||||
/* make the two state lists of context sortable */
|
/* make the two state lists of context sortable */
|
||||||
$(['active', 'hidden']).each(function() {
|
$(['active', 'hidden']).each(function() {
|
||||||
$("#list-contexts-"+this).sortable({
|
$("#list-contexts-"+this).sortable({
|
||||||
handle: '.handle',
|
handle: '.grip',
|
||||||
update: update_order
|
update: update_order
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -430,12 +430,12 @@ input.item-checkbox {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rec_description, .description, .project_description {
|
.rec_description, .description, .project_description, .context_description {
|
||||||
margin-left: 80px;
|
margin-left: 80px;
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.project_description {
|
.project_description, .context_description {
|
||||||
margin-left: 50px;
|
margin-left: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +861,7 @@ form {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-form {
|
.inline-form {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue