Merge branch 'fix/19610-fix-watchers' of https://github.com/floriank/openproject into feature/19575-QUICK-WIN-work-packages-page-styling

Signed-off-by: Alex Coles <alex@alexbcoles.com>

Conflicts:
	app/views/watchers/_watchers.html.erb
pull/2822/head
Alex Coles 10 years ago
commit b49ebc8e1a
  1. 1
      app/assets/stylesheets/content/_choice.md
  2. 25
      app/assets/stylesheets/content/_choice.sass
  3. 16
      app/models/time_entry.rb
  4. 24
      app/views/watchers/_watchers.html.erb

@ -17,4 +17,5 @@ For selection from a list without having to use a form. This can be reused for s
</button>
</div>
</div>
<div class="clearfix"></div>
```

@ -26,10 +26,29 @@
// See doc/COPYRIGHT.rdoc for more details.
//++
//a little hack, the width will be just fine for this element
$choice-parent-relation-select-width: 325px
//resolve the problem if inside are elements with float
.detail-panel-description-content
.relation
clear: both
.choice
+grid-block()
overflow: visible
.choice--select, .choice--button
@extend .form--field
*:nth-last-child(n+2)
padding-right: 1rem
float: left
display: block
.choice--select
overflow: visible
margin-top: 3px
margin-right: 1rem
width: $choice-parent-relation-select-width
.select2
width: inherit
.select2-drop
width: inherit
.choice--button
.button
margin: 2px

@ -112,19 +112,15 @@ class TimeEntry < ActiveRecord::Base
end
def self.earliest_date_for_project(project = nil)
finder_conditions = ARCondition.new(Project.allowed_to_condition(User.current, :view_time_entries))
if project
finder_conditions << ['project_id IN (?)', project.hierarchy.map(&:id)]
end
TimeEntry.minimum(:spent_on, include: :project, conditions: finder_conditions.conditions)
scope = TimeEntry.visible(User.current)
scope = scope.where(project_id: project.hierarchy.map(&:id)) if project
scope.minimum(:spent_on, include: :project)
end
def self.latest_date_for_project(project = nil)
finder_conditions = ARCondition.new(Project.allowed_to_condition(User.current, :view_time_entries))
if project
finder_conditions << ['project_id IN (?)', project.hierarchy.map(&:id)]
end
TimeEntry.maximum(:spent_on, include: :project, conditions: finder_conditions.conditions)
scope = TimeEntry.visible(User.current)
scope = scope.where(project_id: project.hierarchy.map(&:id)) if project
scope.maximum(:spent_on, include: :project)
end
private

@ -44,20 +44,20 @@ See doc/COPYRIGHT.rdoc for more details.
</div>
<div class="single-attribute">
<%= form_for(:watcher,
url: watchers_path(watched.class.name.underscore.pluralize, watched),
method: :post,
remote: true,
complete: "Form.Element.focus('watcher_user_id');",
html: { id: 'new-watcher-form', style: (@watcher ? '' : 'display:none;') }) do |f| %>
<div class="grid-block">
<div class="grid-content small-6">
<%= labelled_tabular_form_for(:watcher,
url: watchers_path(watched.class.name.underscore.pluralize, watched),
method: :post,
remote: true,
complete: "Form.Element.focus('watcher_user_id');",
html: { id: 'new-watcher-form', style: (@watcher ? '' : 'display:none;') }) do |f| %>
<div class="choice">
<div class="choice--select">
<%= f.select :user_id, (watched.addable_watcher_users.collect {|m| [m.name, m.id]}.sort_by{|name, id | name}),
{ :prompt => "--- #{l(:actionview_instancetag_blank_option)} ---" },
class: 'form--select' %>
{ :prompt => "--- #{l(:actionview_instancetag_blank_option)} ---", no_label: true } %>
<%= submit_tag l(:button_add), class: 'button -highlight' %>
<%= toggle_link l(:button_cancel), 'new-watcher-form', {}, class: 'button' %>
</div>
<div class="choice--button">
<%= submit_tag l(:button_add), class: 'button' %>
</div>
</div>
<% end %>

Loading…
Cancel
Save