Skip to content

Commit

Permalink
'Disable cache' option
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbuddha committed Mar 1, 2013
1 parent 9b67504 commit 83900b5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
9 changes: 6 additions & 3 deletions static/coffee/screenly-ose.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class EditAssetView extends Backbone.View
(@$ 'input.time').timepicker
minuteStep: 5, showInputs: yes, disableFocus: yes, showMeridian: yes

(@$ 'input[name="nocache"]').prop 'checked', @model.get 'nocache'
(@$ '.modal-header .close').remove()
(@$el.children ":first").modal()
@model.bind 'change', @render
Expand All @@ -78,6 +79,9 @@ class EditAssetView extends Backbone.View
(@$ '#modalLabel').text "Edit Asset"
(@$ '.asset-location').hide(); (@$ '.asset-location.edit').show()

has_nocache = ((@$ '#tab-uri').hasClass 'active') and (@model.get 'mimetype') is 'image'
(@$ '.nocache').toggle has_nocache

(@$ '.duration').toggle ((@model.get 'mimetype') != 'video')
@clickTabNavUri() if (@model.get 'mimetype') == 'webpage'

Expand Down Expand Up @@ -116,6 +120,7 @@ class EditAssetView extends Backbone.View
e.preventDefault()
@viewmodel()
save = null
@model.set 'nocache', if (@$ 'input[name="nocache"]').prop 'checked' then 1 else 0
if (@$ '#tab-file_upload').hasClass 'active'
if not @$fv 'name'
@$fv 'name', get_filename @$fv 'file_upload'
Expand All @@ -135,13 +140,11 @@ class EditAssetView extends Backbone.View

(@$ 'input, select').prop 'disabled', on
save.done (data) =>
isNew = @model.isNew()
default_duration = @model.get 'duration'
@model.id = data.asset_id
@collection.add @model if not @model.collection
(@$el.children ":first").modal 'hide'
_.extend @model.attributes, data
@model.collection.add @model if isNew
@model.collection.add @model unless @edit
save.fail =>
(@$ '.progress').hide()
(@$ 'input, select').prop 'disabled', off
Expand Down
11 changes: 6 additions & 5 deletions static/js/screenly-ose.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions views/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@
.controls
%input.span1(type="number", name="duration")
seconds
.control-group.nocache
%label.control-label Disable cache
.controls
%label.nocache-toggle.checkbox.toggle.well
%input(type="checkbox", name="nocache")
%p
%span.on Yes
%span.off No
%a.slide-button.btn.btn-primary

.modal-footer
.pull-left.progress.progress-striped.active(style="display:none")
Expand Down

0 comments on commit 83900b5

Please sign in to comment.