Last active
December 20, 2015 23:28
-
-
Save ghigt/6212222 to your computer and use it in GitHub Desktop.
Post Blog Markus [do not touch!]
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
<script type="text/javascript"> | |
//<![CDATA[ | |
jQuery(document).ready(function() { | |
users_table = new FilterTable({ | |
[...] | |
}); | |
}); | |
new Ajax.Request('<%=populate_students_path()%>', | |
{asynchronous:true, evalScripts:true, | |
onComplete:function(request){$('loading_list').hide();}, | |
parameters: 'authenticity_token=' + AUTH_TOKEN}) | |
//]]> | |
</script> |
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
function add_annotation_category(path) { | |
var category_prompt = jQuery('#add_annotation_category_prompt'); | |
if (category_prompt.size()) { | |
category_prompt.select(); | |
category_prompt.focus(); | |
} else { | |
jQuery.ajax({ | |
url: path, | |
type: 'GET' | |
}); | |
var info = jQuery('#no_annotation_categories_info'); | |
if(info.size()) { | |
info.hide(); | |
} | |
} | |
} |
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
jQuery.ajax({ | |
url: "<%= populate_students_path() %>", | |
data: 'authenticity_token=' + AUTH_TOKEN, | |
type: "POST", | |
async: true, | |
dataType: 'json' | |
}).done(function (data) { | |
jQuery('#loading_list').hide(); | |
populate(JSON.stringify(data)); | |
}); |
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
<%= link_to_function t("annotations.add_annotation_category"), %| if($('add_annotation_category_prompt') != null) { | |
$('add_annotation_category_prompt').select(); | |
$('add_annotation_category_prompt').focus(); | |
} else { | |
#{remote_function :url => {:action => "add_annotation_category", :id => @assignment.id}, :method => 'get', :after => "if($('no_annotation_categories_info') != null) { $('no_annotation_categories_info').hide();}" } | |
}|%> |
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
var ModalMarkus = function (elem) { | |
this.elem = elem; | |
this.modal_dialog = jQuery(this.elem).dialog({ | |
autoOpen: false, | |
resizable: false, | |
modal: true, | |
width: 'auto', | |
dialogClass: 'no-close' | |
}); | |
}; | |
ModalMarkus.prototype = { | |
open: function () { | |
this.modal_dialog.dialog('open'); | |
}, | |
close: function () { | |
this.modal_dialog.dialog('close'); | |
} | |
}; |
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
respond_to do |format| | |
format.json { render :json => @students } | |
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
jQuery('#add_annotation_text').replaceWith("<%= escape_javascript(render :partial => 'annotation_text', :locals => { :annotation_text => @annotation_text }).html_safe %>"); | |
jQuery('#annotation_category_pane_list').prepend("<%= escape_javascript("#{render :partial => 'new_annotation_category', :locals => { :assignment_id => @assignment.id }}").html_safe %>"); | |
jQuery('#add_annotation_category_prompt').select(); |
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
page.replace 'add_annotation_category', :partial => 'annotation_category', :locals => {:annotation_category => @annotation_category} | |
page.insert_html :top, | |
'annotation_category_pane_list', | |
:partial => 'new_annotation_category', | |
:locals => {:assignment_id => @assignment.id} | |
page['add_annotation_category_prompt'].focus |
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
get_as @admin, :get_annotations, | |
:assignment_id => @assignment.id, | |
:id => @category.id, | |
:format => :js |
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
result[:filter_table_row_contents] = | |
render_to_string :partial => 'users/table_row/filter_table_row.html.erb', | |
:locals => {:user => user, [...]} |
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
<script type="text/javascript"> | |
<%= render :partial => 'boot.js.erb' %> | |
</script> |
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
<%= button_to_function t('download'), 'modal_download.open();' %> |
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
jQuery(document).ready(function () { | |
window.modal_download = new ModalMarkus('#download_dialog'); | |
}); |
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
.no-close .ui-dialog-titlebar, | |
.no-close .ui-dialog-buttonpane { | |
display: none; | |
} |
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
<% path = add_annotation_category_assignment_annotation_categories_path( | |
:id => @assignment.id) %> | |
<%= link_to_function t('annotations.add_annotation_category'), | |
:onclick => "add_annotation_category('#{path}')" %> |
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
<script type="text/javascript"> | |
//<![CDATA[ | |
var modalUpload = null; | |
var modalDownload = null; | |
function upload_annotation_categories(){ | |
modalUpload.open(); | |
return false; | |
} | |
function download_annotation_categories(){ | |
modalDownload.open(); | |
return false; | |
} | |
document.observe("dom:loaded", function(){ | |
modalUpload = new Control.Modal($('upload_dialog'), | |
{ | |
overlayOpacity: 0.75, | |
className: 'modalUpload', | |
fade: false | |
}); | |
modalDownload = new Control.Modal($('download_dialog'), | |
{ | |
overlayOpacity: 0.75, | |
className: 'modalDownload', | |
fade: false | |
}); | |
}); | |
//]]> | |
</script> |
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
page.call "populate", @students.to_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment