Merge branch 'dev-angular' into fixes/angular-update-copyright-headers

pull/1057/head
Alex Coles 11 years ago
commit 256f4b4cf2
  1. 3
      app/assets/javascripts/angular/directives/work_packages/sort-header-directive.js
  2. 16
      app/assets/javascripts/angular/directives/work_packages/work-package-column-directive.js
  3. 13
      app/assets/javascripts/angular/helpers/components/work-packages-helper.js
  4. 3
      app/assets/javascripts/application.js.erb
  5. 4
      app/assets/stylesheets/default/main.css.erb
  6. 4
      app/helpers/wiki_helper.rb
  7. 2
      app/views/wiki/diff.html.erb
  8. 1
      app/views/work_packages/_time_entry.html.erb
  9. 4
      bower.json
  10. 2
      doc/CHANGELOG.md
  11. 5
      doc/RUNNING_TESTS.md
  12. 2
      features/work_packages/editable_fields.feature
  13. 20
      features/work_packages/index_sums.feature
  14. 43
      features/work_packages/localized_log_time.feature
  15. 3
      public/templates/work_packages/sort_header.html
  16. 3
      public/templates/work_packages/work_packages_table.html
  17. 6
      spec/features/accessibility/custom_fields_spec.rb
  18. 10
      spec/features/custom_fields/custom_fields_page.rb
  19. 4
      spec/features/projects/project_settings_page.rb
  20. 69
      spec/lib/open_project/themes/theme_finder_spec.rb
  21. 2
      test/functional/messages_controller_test.rb
  22. 12
      test/integration/api_test/issues_test.rb
  23. 2
      test/unit/query_test.rb

@ -38,7 +38,8 @@ angular.module('openproject.workPackages.directives')
headerName: '=',
headerTitle: '=',
sortable: '=',
updateResults: '&'
updateResults: '&',
locale: '='
},
link: function(scope, element, attributes) {
scope.performSort = function(){

@ -42,17 +42,21 @@ angular.module('openproject.workPackages.directives')
link: function(scope, element, attributes) {
scope.displayType = scope.displayType || 'text';
// custom display types
if (scope.column.name === 'done_ratio') {
scope.displayType = 'progress_bar';
}
// Set text to be displayed
scope.$watch('workPackage', setColumnData, true);
function setColumnData() {
// retrieve column value from work package
scope.displayText = WorkPackagesHelper.getFormattedColumnValue(scope.workPackage, scope.column) || '';
if (scope.column.custom_field) {
var custom_field = scope.column.custom_field;
scope.displayText = WorkPackagesHelper.getFormattedCustomValue(scope.workPackage, custom_field) || '';
} else {
// custom display types
if (scope.column.name === 'done_ratio') scope.displayType = 'progress_bar';
scope.displayText = WorkPackagesHelper.getFormattedColumnData(scope.workPackage, scope.column) || '';
}
if (scope.column.meta_data.data_type === 'user') loadUserName();

@ -54,7 +54,7 @@ angular.module('openproject.workPackages.helpers')
}
},
getRowObjectCustomValue: function(object, customField) {
getFormattedCustomValue: function(object, customField) {
if (!object.custom_values) return null;
var customValue = object.custom_values.filter(function(customValue){
@ -66,15 +66,10 @@ angular.module('openproject.workPackages.helpers')
}
},
getFormattedColumnValue: function(rowObject, column) {
var value;
getFormattedColumnData: function(object, column) {
var value = WorkPackagesHelper.getRowObjectContent(object, column.name);
if (column.custom_field) {
return WorkPackagesHelper.getRowObjectCustomValue(rowObject, column.custom_field);
} else {
value = WorkPackagesHelper.getRowObjectContent(rowObject, column.name);
return WorkPackagesHelper.formatValue(value, column.meta_data.data_type);
}
return WorkPackagesHelper.formatValue(value, column.meta_data.data_type);
},
formatValue: function(value, dataType) {

@ -15,7 +15,7 @@
//= require jquery-ui
//= require jquery-ui/ui/i18n/jquery-ui-i18n
//= require jquery.atwho
//= require jquery.atwho/dist/js/jquery.atwho.js
//= require Caret.js/src/jquery.caret
//= require jquery_noconflict
//= require prototype
@ -127,6 +127,7 @@ jQuery(document).ready(function ($) {
$(this).find('.icon').toggleClass('icon-arrow-right6-3 icon-arrow-right6-1');
Effect.toggle("work_package_descr_fields", "appear", {duration:0.3});
enable_textarea_auto_completion(jQuery("#work_package_description"));
return false;
});

@ -720,7 +720,6 @@ ins.diffmod, ins.diffins { background: #cfc; }
/***** My page layout *****/
img.gravatar {
border: solid 1px #d5d5d5;
background: #fff;
}
@ -991,9 +990,6 @@ div.issue hr {
#content div.issue table th {
font-weight: bold;
}
.gravatar {
border: 1px solid #aaa;
}
.issue p {
margin-bottom: 5px;
}

@ -53,4 +53,8 @@ module WikiHelper
breadcrumb_paths(*(related_pages.collect{|parent| link_to h(parent.breadcrumb_title), {:id => parent.title, :project_id => parent.project, :action => "show"}} + [h(page.breadcrumb_title)]))
end
end
def nl2br(content)
content.gsub(/(?:\n\r?|\r\n?)/, '<br />').html_safe
end
end

@ -44,5 +44,5 @@ See doc/COPYRIGHT.rdoc for more details.
</p>
<div class="text-diff">
<%= @html_diff.html_safe %>
<%= nl2br @html_diff %>
</div>

@ -36,6 +36,7 @@ See doc/COPYRIGHT.rdoc for more details.
<div class="splitcontentleft">
<div class="attribute_wrapper">
<%= fields.text_field :hours,
:value => number_with_delimiter(time_entry.hours, locale: I18n.locale),
:label => :label_spent_time,
:placeholder => TimeEntry.human_attribute_name(:hours),
:class => 'short' %>

@ -4,7 +4,7 @@
"dependencies": {
"jquery": "1.7.2",
"jquery-ujs": "latest",
"select2": "~3.3.2",
"select2": "3.3.2",
"jquery.atwho": "latest",
"openproject-ui_components": "opf/openproject-ui_components#with-bower",
"angular": "~1.2.14",
@ -19,7 +19,7 @@
"chai": "~1.9.0"
},
"resolutions": {
"select2": "~3.4",
"select2": "3.3.2",
"jquery": "1.7.2"
}
}

@ -32,6 +32,8 @@ See doc/COPYRIGHT.rdoc for more details.
* `#284` Fix: Sticky does not apply to forum
* `#2393` Fix: No warning when leaving site without saving
* `#2401` Fix: New target version cannot be created from work package view
* `#2280` Fix: Spent Time not localized
* `#3148` Fix: Comparison of history versions in wiki pages ignores newlines
* `#3267` Fix: Link in Breadcrumbs links to global work packages
* `#3348` Fix: Menu item "more functions" is cut off where content ends
* `#3395` Fix: After error message values are gone during creation of message

@ -31,7 +31,7 @@ See doc/COPYRIGHT.rdoc for more details.
## Cucumber
The cucucmber features can be run using rake. You can run the following
The cucumber features can be run using rake. You can run the following
rake tasks using the command `bundle exec rake <task>`.
* `cucumber` Run core features
@ -121,5 +121,4 @@ You let test unit display test names instead of anonymous dots with the followin
## Manual acceptance tests
* Sometimes you want to test things manually. Always remember: If you test something more than once, write an automated test for it.
* Assuming you do not have all Internet Explorer version installed on your computer, you can grab a VM with preinstalled IE's directly from Mircrosoft: http://www.modern.ie/en-us/virtualization-tools#downloads
* Assuming you do not have a version of Internet Explorer already installed on your computer, you can grab a VM with preinstalled IE's directly from Microsoft: http://www.modern.ie/en-us/virtualization-tools#downloads

@ -130,4 +130,4 @@ Feature: Fields editable on work package edit
When I go to the edit page of the work package called "pe1"
Then I should see the following fields:
| cf1 | 4 |
| cf1 | 4 |

@ -26,7 +26,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
Feature: Disabled done ratio on the work package index
Feature: Calculated sums on the work package index
Background:
Given there is 1 project with the following:
@ -54,13 +54,13 @@ Feature: Disabled done ratio on the work package index
And the user "jimmy" is a "member" in the project "project1"
And there are the following issues in project "project1":
| subject | type | author | assignee | done_ratio |
| issue1 | Bug | bob | jimmy | 10 |
| issue2 | Feature | bob | jimmy | 10 |
| issue3 | Bug | bob | jimmy | 0 |
| issue4 | Feature | jimmy | bob | 0 |
| issue5 | Bug | jimmy | bob | 50 |
| issue6 | Feature | jimmy | bob | 50 |
| subject | type | author | assignee | estimated_hours |
| issue1 | Bug | bob | jimmy | 10 |
| issue2 | Feature | bob | jimmy | 8 |
| issue3 | Bug | bob | jimmy | 0 |
| issue4 | Feature | jimmy | bob | 0 |
| issue5 | Bug | jimmy | bob | 5 |
| issue6 | Feature | jimmy | bob | 3 |
And I am already logged in as "bob"
@ -68,6 +68,6 @@ Feature: Disabled done ratio on the work package index
Scenario: Total sum of summable column should be displayed when display sums checkbox is checked
When I go to the work packages index page of the project "project1"
And I click "Options"
And I select to see column "% done"
And I select to see column "Estimated time"
And I check "display_sums"
Then I should see "120" within ".sum.group.all"
Then I should see "26" within ".sum.group.all"

@ -0,0 +1,43 @@
Feature: Adding localized time log
Background:
Given the following languages are active:
| en |
| de |
And there is 1 user with:
| login | manager |
| firstname | the |
| lastname | manager |
| language | de |
And there is 1 project with the following:
| identifier | ecookbook |
| name | ecookbook |
And there is a role "manager"
And the role "manager" may have the following rights:
| edit_work_packages |
| view_work_packages |
| log_time |
And I am working in project "ecookbook"
And the project uses the following modules:
| time_tracking |
And the user "manager" is a "manager"
And there are the following status:
| name | default |
| status1 | true |
And there are the following work packages in project "ecookbook":
| subject | status_id |
| pe1 | 1 |
And there is an activity "design"
And I am already logged in as "manager"
@javascript
Scenario: Adding a localized time entry
Given I am on the edit page of the work package called "pe1"
When I follow "Mehr"
And I fill in the following:
| Thema | |
| Aufgewendete Zeit | 2,5 |
| Aktivität | design |
And I submit the form by the "OK" button
Then I should be on the page of the work package "pe1"
And I should see 1 error message
And the "work_package_time_entry_hours" field should contain "2,5"

@ -2,7 +2,8 @@
<a ng-if="sortable"
ng-class="[currentSortDirection && 'sort', currentSortDirection]"
ng-click="performSort()"
lang-attribute>
lang-attribute
lang="{{locale}}">
{{headerTitle}}
</a>
<span ng-if="!sortable">{{headerTitle}}</span>

@ -20,6 +20,7 @@
update-results="updateResults()"/>
<th sort-header ng-repeat="column in columns"
locale="column.custom_field && columns.custom_field.name_locale || I18n.locale"
header-name="column.name"
header-title="column.title"
sortable="column.sortable"
@ -107,7 +108,7 @@
<a ng-href="/work_packages/{{row.object.id}}">{{row.object.id}}</a>
</td>
<td ng-repeat="column in columns" class="{{column.name}}">
<td ng-repeat="column in columns" class="{{column.name}}" lang="{{column.custom_field && column.custom_field.name_locale || I18n.locale}}">
<span work-package-column
work-package="row.object"
column="column"

@ -57,7 +57,7 @@ describe 'Custom field accessibility' do
describe 'Custom Field Admin Page', js: true do
let(:custom_fields_page) { CustomFieldsPage.new }
let(:element) { find("#custom_field_name_attributes span[lang]") }
let(:element) { custom_fields_page.name_attributes }
shared_context "custom field new page" do
let(:available_languages) { [locale] }
@ -119,7 +119,7 @@ describe 'Custom field accessibility' do
end
describe 'Default value locale change' do
let(:element) { find("#custom_field_default_value_attributes span[lang]") }
let(:element) { custom_fields_page.default_value_attributes }
let(:element_selector) { "#custom_field_default_value_attributes select.locale_selector option[value='#{element_locale}']" }
context "en" do
@ -145,7 +145,7 @@ describe 'Custom field accessibility' do
describe 'Project Settings' do
let(:project_settings_page) { ProjectSettingsPage.new(project) }
let(:element) { find("fieldset#project_issue_custom_fields label span") }
let(:element) { project_settings_page.fieldset_label }
shared_context "project settings page" do
before do

@ -31,6 +31,14 @@ class CustomFieldsPage
include Capybara::DSL
def visit_new(type="WorkPackageCustomField")
visit new_custom_field_path(type: type)
visit new_custom_field_path type: type
end
def name_attributes
find '#custom_field_name_attributes span[lang]'
end
def default_value_attributes
find '#custom_field_default_value_attributes span[lang]'
end
end

@ -38,6 +38,10 @@ class ProjectSettingsPage
visit settings_path
end
def fieldset_label
find 'fieldset#project_issue_custom_fields label span'
end
private
def settings_path

@ -80,19 +80,6 @@ module OpenProject
expect(ThemeFinder.themes).to include theme
end
# TODO: clean me up
it "registers the theme's stylesheet manifest for precompilation" do
Class.new(Theme) { def stylesheet_manifest; 'stylesheet_path.css'; end }
# TODO: gives an error on the whole list
# TODO: remove themes from the list, when clear_themes is called
precompile_list = Rails.application.config.assets.precompile
precompile_list = Array(precompile_list.last)
precompile_list.map! { |element| element.respond_to?(:call) ? element.call : element }
expect(precompile_list).to include 'stylesheet_path.css'
end
it "clears the cache successfully" do
ThemeFinder.registered_themes # fill the cache
theme = Theme.new_theme do |theme|
@ -100,6 +87,62 @@ module OpenProject
end
expect(ThemeFinder.registered_themes).to include :new_theme => theme
end
context 'asset precompilation' do
around do |example|
old_precompile_config = Rails.application.config.assets.precompile
Rails.application.config.assets.precompile.clear
example.run
Rails.application.config.assets.precompile = old_precompile_config
end
let(:asset_files) {
%w(
adn-bootstrap.css
adn-bootstrap-theme.css
ms-rainbow-colours.css
theme_stylesheet.css
)
}
let(:precompile_list) { Rails.application.config.assets.precompile }
let(:precompiled_assets) {
asset_files.map { |asset_path|
precompile_list.map { |element|
element.respond_to?(:call) ? element.call(asset_path) : element
}
}.flatten
}
# TODO: remove themes from the list, when clear_themes is called
context 'with no stylesheet manifest registered' do
it 'should precompile none of asset files' do
expect(precompiled_assets).to be_none
end
end
context 'with a missing stylesheet manifest registered' do
before do
Class.new(Theme) { def stylesheet_manifest; 'missing_theme_stylesheet.css'; end }
end
it 'should precompile none of asset files' do
expect(precompiled_assets).to be_none
end
end
context 'with a stylesheet manifest registered' do
before do
Class.new(Theme) { def stylesheet_manifest; 'theme_stylesheet.css'; end }
end
it 'should precompile one of the asset files' do
expect(precompiled_assets).to be_any
expect(precompiled_assets.count{ |c| c }).to eq 1
end
end
end
end
describe '.forget_theme' do

@ -61,7 +61,7 @@ class MessagesControllerTest < ActionController::TestCase
message.children << m
end
end
get :show, :board_id => 1, :id => 1, :r => message.children.last(:order => 'id').id
get :show, board_id: 1, id: 1, per_page: 100, r: message.children.last(order: 'id').id
assert_response :success
assert_template 'show'
replies = assigns(:replies)

@ -44,12 +44,12 @@ class ApiTest::IssuesTest < ActionDispatch::IntegrationTest
should "contain metadata" do
get '/api/v1/issues.xml'
assert_tag :tag => 'issues',
:attributes => {
:type => 'array',
:total_count => assigns(:issues).total_entries,
:limit => 100,
:offset => 0
assert_tag tag: 'issues',
attributes: {
type: 'array',
total_count: assigns(:issues).total_entries,
limit: Setting.per_page_options_array.first,
offset: 0
}
end

@ -387,7 +387,7 @@ class QueryTest < ActiveSupport::TestCase
def test_label_for
q = Query.new name: '_'
assert_equal 'assigned_to', q.label_for('assigned_to_id')
assert_equal WorkPackage.human_attribute_name("assigned_to_id"), q.label_for('assigned_to_id')
end
def test_editable_by

Loading…
Cancel
Save