Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Updated from opf/openproject dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Aug 20, 2018
2 parents 983292d + 3c4dd6f commit 1e2a04e
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 50 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/content/_action_menu_main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
ul
list-style-type: none
margin: 0
width: 230px
width: 240px
border: 1px solid #dddddd
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15)
padding: 3px 0
Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/content/_modal.sass
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ ul.export-options
margin: 0 0 30px 0
text-align: center
display: inline-block
min-width: 32%
width: 32%
a
cursor: pointer
text-decoration: none
color: $body-font-color
font-weight: normal
overflow-wrap: break-word
word-wrap: break-word
&:hover, &:active
text-decoration: none
color: $body-font-color
Expand Down
3 changes: 2 additions & 1 deletion app/cells/views/settings/text_setting/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
label: false,
id: "settings-#{name}-#{lang}",
class: 'wiki-edit',
with_text_formatting: true,
rows: 5,
container_class: '-wide'
container_class: '-xxwide'
)
%>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/text_formatting_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def preview_context(object, project = nil)
#TODO remove
def current_formatting_helper
helper_class = OpenProject::TextFormatting::Formats.rich_helper
helper_class.new(self)
helper_class.new
end

def project_preview_context(object, project)
Expand Down
6 changes: 5 additions & 1 deletion app/models/news.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class News < ActiveRecord::Base
order('created_on')
}, as: :commented, dependent: :delete_all

validates_presence_of :title, :description
validates_presence_of :title
validates_length_of :title, maximum: 60
validates_length_of :summary, maximum: 255

Expand Down Expand Up @@ -62,6 +62,10 @@ def visible?(user = User.current)
!user.nil? && user.allowed_to?(:view_news, project)
end

def description=(val)
super val.presence || ''
end

# returns latest news for projects visible by user
def self.latest(user: User.current, count: 5)
latest_for(user, count: count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ def data_rows
if options[:show_attachments] && work_package.attachments.exists?
attachments = make_attachments_cells(work_package.attachments)

result << [
{ content: pdf.make_table([attachments]), colspan: description_colspan }
]
if attachments.any?
result << [
{ content: pdf.make_table([attachments]), colspan: description_colspan }
]
end
end

if query.grouped? && (group = query.group_by_column.value(work_package)) != previous_group
Expand Down
1 change: 0 additions & 1 deletion app/views/messages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ See docs/COPYRIGHT.rdoc for more details.

<div class="form--field -required">
<%= f.text_area :content,
required: true,
label: t(:description_message_content),
class: 'wiki-edit',
container_class: '-xxwide',
Expand Down
1 change: 0 additions & 1 deletion app/views/news/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<div class="form--field">
<%= f.text_area :description,
required: true,
class: 'wiki-edit wiki-toolbar',
container_class: '-wide',
with_text_formatting: true %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/form/attributes/_description.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ See docs/COPYRIGHT.rdoc for more details.
with_text_formatting: true,
rows: 5,
class: 'wiki-edit',
container_class: '-wide' %>
container_class: '-xxwide' %>
</div>
2 changes: 1 addition & 1 deletion app/views/settings/_general.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ See docs/COPYRIGHT.rdoc for more details.
class: 'wiki-edit',
id: 'settings_welcome_text',
with_text_formatting: true,
container_class: '-wide' %>
container_class: '-xxwide' %>
</div>
<div class="form--field"><%= setting_check_box :welcome_on_homescreen %></div>
</fieldset>
Expand Down
6 changes: 4 additions & 2 deletions config/initializers/secure_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
# Allow requests to CLI in dev mode
connect_src = default_src

# Add proxy configuration for Angular CLI to csp
if FrontendAssetHelper.assets_proxied?
connect_src += %w[ws://localhost:* http://localhost:*]
assets_src += %w[ws://localhost:* http://localhost:*]
proxied = ['ws://localhost:*', 'http://localhost:*', FrontendAssetHelper.cli_proxy]
connect_src += proxied
assets_src += proxied
end

config.csp = {
Expand Down
19 changes: 19 additions & 0 deletions docs/development/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ on a machine with 8 parallel instances.
If you want to access the development server of OpenProject from a VM,
you need to work around the CSP `localhost` restrictions.


### Old way, fixed compilation

One way is to disable the Angular CLI that serves some of the assets when developing. To do that, run

```bash
Expand All @@ -255,6 +258,22 @@ OPENPROJECT_CLI_PROXY='' ./bin/rails s -b 0.0.0.0 -p 3000

Now assuming networking is set up in your VM, you can access your app server on `<your local ip>:3000` from it.

### New way, with ng serve

**The better way** when you want to develop against Edge is to set up your server to allow the CSP to the remote host.
Assuming your openproject is served at `<your local ip>:3000` and your ng serve middleware is running at `<your local ip>:4200`,
you can access both from inside a VM with nat/bridged networking as follows:

```bash
# Start ng serve middleware binding to all interfaces
ng serve --host 0.0.0.0

# Start your openproject server with the CLI proxy configuration set
OPENPROJECT_CLI_PROXY='<your local ip>:4200' ./bin/rails s -b 0.0.0.0 -p 3000

# Now access your server from http://<your local ip>:3000 with code reloading
```

## Legacy LDAP tests

OpenProject supports using LDAP for user authentications. To test LDAP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ export class WorkPackageTableColumnsService extends WorkPackageTableBaseService<
}

public applyToQuery(query:QueryResource) {
query.columns = cloneHalResourceCollection<QueryColumn>(this.getColumns());
const toApply = this.getColumns();

const oldColumns = query.columns.map(el => el.id);
const newColumns = toApply.map(el => el.id);
query.columns = cloneHalResourceCollection<QueryColumn>(toApply);

// We can avoid reloading even with relation columns if we only removed columns
const onlyRemoved = _.difference(newColumns, oldColumns).length === 0;

// Reload the table visibly if adding relation columns.
return this.hasRelationColumns();
return !onlyRemoved && this.hasRelationColumns();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<i class="icon-search wp-query-menu--search-icon"></i>
</div>
<div #queryResultsContainer class="wp-query-menu--results-container">
<p class="wp-query-menu--no-results-container"
[hidden]="!noResults"
[textContent]="text.no_results"></p>
</div>
<p class="wp-query-menu--no-results-container"
[hidden]="!noResults"
[textContent]="text.no_results"></p>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class WorkPackageWatchersTabComponent implements OnInit, OnDestroy {
const img = document.createElement('img');
img.src = item.watcher.avatar;
img.alt = item.watcher.name;
img.classList.add('avatar-mini');
img.classList.add('avatar-mini', 'avatar--fallback');

link.appendChild(img);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/open_project/form_tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def styled_text_area_tag(name, content = nil, options = {})
def text_formatting_wrapper(target_id, options)
return ''.html_safe unless target_id.present?

helper = ::OpenProject::TextFormatting::Formats.rich_helper.new(self)
helper = ::OpenProject::TextFormatting::Formats.rich_helper.new
helper.wikitoolbar_for target_id, options
end

Expand Down
17 changes: 10 additions & 7 deletions lib/open_project/text_formatting/formats/markdown/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@
module OpenProject::TextFormatting::Formats
module Markdown
class Helper
attr_reader :view_context

def initialize(view_context)
@view_context = view_context
end
def initialize; end

def text_formatting_js_includes
view_context.javascript_include_tag 'vendor/ckeditor/ckeditor.js'
helpers.javascript_include_tag 'vendor/ckeditor/ckeditor.js'
end

def wikitoolbar_for(field_id, **context)
# Hide the original textarea
view_context.content_for(:additional_js_dom_ready) do
helpers.content_for(:additional_js_dom_ready) do
js = <<-JAVASCRIPT
var field = document.getElementById('#{field_id}');
field.style.display = 'none';
Expand All @@ -55,12 +52,18 @@ def wikitoolbar_for(field_id, **context)

# Pass an optional resource to the CKEditor instance
resource = context.fetch(:resource, {})
view_context.content_tag 'op-ckeditor-form',
helpers.content_tag 'op-ckeditor-form',
'',
'textarea-selector': "##{field_id}",
'preview-context': context[:preview_context],
'data-resource': resource.to_json
end

protected

def helpers
ApplicationController.helpers
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def models_to_convert
::Journal => [:notes],
::Journal::MessageJournal => [:content],
::Journal::WikiContentJournal => [:text],
::Journal::WorkPackageJournal => [:description]
::Journal::WorkPackageJournal => [:description],
::AttributeHelpText => [:help_text]
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tabular_form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def field_container_css_class(selector, options)
def text_formatting_wrapper(target_id, options)
return ''.html_safe unless target_id.present?

helper = ::OpenProject::TextFormatting::Formats.rich_helper.new(@template)
helper = ::OpenProject::TextFormatting::Formats.rich_helper.new
helper.wikitoolbar_for target_id, options
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,6 @@ Feature: Scrum Master
And Story A should be in the 2nd position of the sprint named Sprint 001
And Story B should be the higher item of Story A

Scenario: view the sprint notes
Given I have set the content for wiki page Sprint Template to Sprint Template
And I have made Sprint Template the template page for sprint notes
And I am on the taskboard for "Sprint 001"
When I view the sprint notes
Then the request should complete successfully
Then the wiki page Sprint 001 should contain Sprint Template

Scenario: edit the sprint notes
Given I have set the content for wiki page Sprint Template to Sprint Template
And I have made Sprint Template the template page for sprint notes
And I am on the taskboard for "Sprint 001"
When I edit the sprint notes
Then the request should complete successfully
Then the wiki page Sprint 001 should contain Sprint Template

Scenario: View tasks that have subtasks
Given I am on the taskboard for "Sprint 005"
Then I should see "Task 10" within "#tasks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
it 'leads to cost reports' do
click_on 'Cost reports'

expect(page).to have_selector('.breadcrumb > li', text: 'Ponyo')
expect(page).to have_selector('.breadcrumb > li', text: 'Cost reports')
expect(page).to have_selector('.button--dropdown-text', text: 'Ponyo')
end
end

Expand Down Expand Up @@ -100,8 +99,6 @@
click_on 'Cost reports', visible: false
end

expect(page).to have_selector('.breadcrumb > li', text: 'Cost reports')

# to make sure we're not seeing the project cost reports:
expect(page).not_to have_text('Ponyo')
end
Expand Down

0 comments on commit 1e2a04e

Please sign in to comment.