calendar event with > 58 chars title truncated in undated list
when an undated event is created on caledar2 month view with a very long name, the name will be truncated in the undated list and will retain the truncation when dragging the event to a date. fixes CNVS-1256 test steps: - create a new course - go to calendar2 - create an undated event with a title that is > 58 charactes - ensure that the event on the right hand side is truncated - click and drag the event out to a date and ensure the name is truncated Change-Id: I94b36736d87acd7d5afb8501bfa78d02f182d2b9 Reviewed-on: https://gerrit.instructure.com/18210 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Mark Ericksen <marke@instructure.com> QA-Review: Marc LeGendre <marc@instructure.com>
This commit is contained in:
parent
d40142b880
commit
1f2fed44b9
|
@ -8,10 +8,11 @@ define [
|
|||
'compiled/util/dateSelect'
|
||||
'compiled/util/mimeClass'
|
||||
'compiled/str/convertApiUserContent'
|
||||
'compiled/str/TextHelper'
|
||||
'jquery.instructure_date_and_time'
|
||||
'jquery.instructure_misc_helpers'
|
||||
'jquery.instructure_misc_plugins'
|
||||
], (Handlebars, I18n, $, _, htmlEscape, semanticDateRange, dateSelect, mimeClass, convertApiUserContent) ->
|
||||
], (Handlebars, I18n, $, _, htmlEscape, semanticDateRange, dateSelect, mimeClass, convertApiUserContent, textHelper) ->
|
||||
|
||||
Handlebars.registerHelper name, fn for name, fn of {
|
||||
t : (key, defaultValue, options) ->
|
||||
|
@ -289,5 +290,9 @@ define [
|
|||
'disabled'
|
||||
else
|
||||
''
|
||||
|
||||
truncate: ( string, max ) ->
|
||||
return textHelper.truncateText( string, { max: max } )
|
||||
|
||||
}
|
||||
return Handlebars
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{{#if events}}
|
||||
<b>Undated Events</b>
|
||||
<b>{{#t "undated_events"}}Undated Events{{/t}}</b>
|
||||
<ul>
|
||||
{{#each events}}
|
||||
<li class="undated_event event group_{{contextCode}} {{id}}" data-event-id="{{id}}">
|
||||
<i class='icon-{{icon}}' aria-hidden='true'></i>
|
||||
<a href="{{details_url}}" class='undated_event_title'>{{title}}</a>
|
||||
<a href="{{details_url}}" class='undated_event_title'>{{#truncate title 35}}{{/truncate}}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<div class="spin_holder"></div>
|
||||
<a href="#" data-text-while-loading="Loading undated events..." class="undated-events-link">Show undated events</a>
|
||||
{{/if}}
|
||||
<a href="#" data-text-while-loading="{{#t "loading_undated_events"}}Loading undated events...{{/t}}" class="undated-events-link">{{#t "show_undated_events"}}Show undated events{{/t}}</a>
|
||||
{{/if}}
|
|
@ -150,6 +150,17 @@ describe "calendar2" do
|
|||
undated_events.size.should == 1
|
||||
undated_events.first.text.should =~ /#{e.title}/
|
||||
end
|
||||
|
||||
it "should truncate very long undated event titles" do
|
||||
e = make_event :start => nil, :title => "asdfjkasldfjklasdjfklasdjfklasjfkljasdklfjasklfjkalsdjsadkfljasdfkljfsdalkjsfdlksadjklsadjsadklasdf"
|
||||
get "/calendar2"
|
||||
|
||||
f(".undated-events-link").click
|
||||
wait_for_ajaximations
|
||||
undated_events = ff("#undated-events > ul > li")
|
||||
undated_events.size.should == 1
|
||||
undated_events.first.text.should == "asdfjkasldfjklasdjfklasdjfklasjf..."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Dir.glob("#{File.dirname(__FILE__).gsub(/\\/, "/")}/factories/*.rb").each { |fil
|
|||
# globally on every object. :context is already heavily used in our application,
|
||||
# so we remove rspec's definition.
|
||||
module Spec::DSL::Main
|
||||
remove_method :context
|
||||
remove_method :context if respond_to? :context
|
||||
end
|
||||
|
||||
def truncate_table(model)
|
||||
|
|
Loading…
Reference in New Issue