This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Any action that needs the UI to update tells the client to make a request for new data instead of supplying the data itself. This will make it easier to preserve UI state for auto-updates.
- Loading branch information
Showing
12 changed files
with
21 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,57 +1,6 @@ | |||
createAddPlaceDialog = -> | |||
addDialog = $('#add-place-dialog') | |||
addForm = addDialog.find 'form' | |||
|
|||
placeNameField = $('#place_name') | |||
notesField = $('#place_notes') | |||
walkingField = $('#place_walkable') | |||
timeFields = $('#add-place-dialog select') | |||
submitButton = $('#add-place-dialog input[type=submit]') | |||
|
|||
addDialog.dialog | |||
autoOpen: false | |||
modal: true | |||
title: $('#add-place').text() | |||
resizable: false | |||
buttons: [{ | |||
text: submitButton.val() | |||
click: -> | |||
addForm.submit() | |||
}] | |||
open: -> | |||
placeNameField.val '' | |||
notesField.val '' | |||
timeFields.val '' | |||
walkingField.removeAttr 'checked' | |||
placeNameField.focus() | |||
|
|||
$('#add-place').button(icons: {primary:"ui-icon-plusthick"}).click -> | |||
addDialog.dialog 'open' | |||
|
|||
submitButton.hide() | |||
|
|||
createEditPlaceDialog = -> | |||
editDialog = $('#edit-place-dialog') | |||
editDialog.dialog | |||
autoOpen: false | |||
modal: true | |||
title: editDialog.attr('title') | |||
resizable: false | |||
|
|||
createCommentDialog = -> | |||
commentDialog = $('#comment-dialog') | |||
commentDialog.dialog | |||
autoOpen: false | |||
modal: true | |||
title: commentDialog.attr('title') | |||
resizable: false | |||
|
|||
$(document).ready -> | $(document).ready -> | ||
$('#add-place').on 'show', (e) -> | $('#add-place').on 'show', (e) -> | ||
$('#place_name').val '' | $('#place_name').val '' | ||
$('#place_notes').val '' | $('#place_notes').val '' | ||
$('#place_walkable').removeAttr 'checked' | $('#place_walkable').removeAttr 'checked' | ||
$('select', $(e.target)).val '' | $('select', $(e.target)).val '' | ||
# createAddPlaceDialog() | |||
# createEditPlaceDialog() | |||
# createCommentDialog() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,8 @@ | |||
$('#container').tooltip | window.updatePlaces = -> | ||
selector: 'a[rel="tooltip"]', | $.get '/periodic', (data) -> | ||
placement: 'right' | $('#places').html(data) | ||
|
|||
$(document).ready -> | |||
$('#container').tooltip | |||
selector: 'a[rel="tooltip"]', | |||
placement: 'right' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,10 +1,7 @@ | |||
<% if @place.valid? %> | <% if @place.valid? %> | ||
$('#places') | updatePlaces(); | ||
.trigger('beforeupdate') | |||
.html('<%= escape_javascript(render :partial => "places") %>') | |||
.trigger('update'); | |||
$('#add-place').modal('hide'); | $('#add-place').modal('hide'); | ||
<%= js_notice t('.success', :name => @place.name) %> | <%= js_notice t('.success', :name => @place.name) %> | ||
<% else %> | <% else %> | ||
<%= js_error @place %> | <%= js_error @place %> | ||
<% end %> | <% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,5 +1,2 @@ | |||
$('#places') | updatePlaces(); | ||
.trigger('beforeupdate') | <%= js_notice t('.success', :name => @place.name) %> | ||
.html('<%= escape_javascript(render :partial => "places") %>') | |||
.trigger('update'); | |||
<%= js_notice t('.success', :name => @place.name) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,10 +1,7 @@ | |||
<% if @place.valid? %> | <% if @place.valid? %> | ||
$('#places') | updatePlaces(); | ||
.trigger('beforeupdate') | |||
.html('<%= escape_javascript(render :partial => "places") %>') | |||
.trigger('update'); | |||
$('#edit-place').modal('hide'); | $('#edit-place').modal('hide'); | ||
<%= js_notice t('.success', :name => @place.name) %> | <%= js_notice t('.success', :name => @place.name) %> | ||
<% else %> | <% else %> | ||
<%= js_error @place %> | <%= js_error @place %> | ||
<% end %> | <% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,5 +1,2 @@ | |||
$('#places') | updatePlaces(); | ||
.trigger('beforeupdate') | <%= js_notice t('.success', :name => @vote.place.name) %> | ||
.html('<%= escape_javascript(render :partial => "places/places") %>') | |||
.trigger('update'); | |||
<%= js_notice t('.success', :name => @vote.place.name) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters