Skip to content

Commit

Permalink
Fix/help text bugs (#5745)
Browse files Browse the repository at this point in the history
* [25778] Sort available help attributes

* [25799] Use proc for inclusion check

Otherwise, that value is never re-evaluated. A newly created CF
will fail to be found.

https://community.openproject.com/wp/25779/

* [25780] Remove paragraph signs in headings of help text modal

* [25781] Overflow help text modal after 50vh

* [25782] Add ellipsis to modal header


[ci skip]
  • Loading branch information
oliverguenther authored Jul 11, 2017
1 parent 68b7095 commit 52fdada
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions app/assets/stylesheets/content/_help_texts.sass
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,26 @@
//++
.attribute-help-text--modal
// Set max width of the attribute heading
.modal--header > h2
width: calc(100% - 80px)

.modal--footer
text-align: left
display: flex
justify-content: space-between

// Set max height of the modal body
.modal--main
max-height: 50vh
overflow-y: auto

// Avoid large right margin for conditional button
.help-text--edit-button
margin-right: 0

// Hide the wiki-anchor
.wiki-anchor,
*:hover .wiki-anchor
display: none

8 changes: 5 additions & 3 deletions app/helpers/attribute_help_texts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program::Type.translated_work_package_form_attributes; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
Expand All @@ -33,7 +33,9 @@ def selectable_attributes(instance)
available = instance.class.available_attributes
used = AttributeHelpText.used_attributes(instance.type)

available.reject! { |k,| used.include? k }
available.map { |k, v| [v, k] }
available
.reject { |key,| used.include? key }
.map { |key, label| [label, key] }
.sort_by { |label, key| label.downcase }
end
end
2 changes: 1 addition & 1 deletion app/models/attribute_help_text/work_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.available_attributes
attributes
end

validates_inclusion_of :attribute_name, in: available_attributes.keys
validates_inclusion_of :attribute_name, in: ->(*) { available_attributes.keys }

def attribute_scope
'WorkPackage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div class="modal--header">
<span class="icon-context icon-help2"></span>
<h2 ng-bind="::resource.attributeCaption"></h2>
<h2 class="ellipsis" ng-bind="::resource.attributeCaption"></h2>
</div>

<div class="modal--main"
Expand Down

0 comments on commit 52fdada

Please sign in to comment.