Last files of migration to slim
This commit is contained in:
parent
2f407e451b
commit
4ee6fa2993
@ -1,19 +0,0 @@
|
||||
<%= javascript_tag do %>
|
||||
$(function() {
|
||||
// when the #search field changes
|
||||
$('#search').live_observe_field(2, function() {
|
||||
var form = $('#query_form'); // grab the form wrapping the search bar.
|
||||
var url = form.attr('action');
|
||||
form.find('[name="c[]"] option').each(function(i, elem){
|
||||
$(elem).attr('selected', true)
|
||||
})
|
||||
var formData = form.serialize();
|
||||
form.find('[name="c[]"] option').each(function(i, elem){
|
||||
$(elem).attr('selected', false)
|
||||
})
|
||||
$.get(url, formData, function(data) { // perform an AJAX get, the trailing function is what happens on successful get.
|
||||
$("#query-result-list").html(data); // replace the "results" div with the result of action taken
|
||||
});
|
||||
});
|
||||
});
|
||||
<% end %>
|
18
app/views/additionals/_live_search_ajax_call.js.slim
Normal file
18
app/views/additionals/_live_search_ajax_call.js.slim
Normal file
@ -0,0 +1,18 @@
|
||||
javascript:
|
||||
$(function() {
|
||||
// when the #search field changes
|
||||
$('#search').live_observe_field(2, function() {
|
||||
var form = $('#query_form'); // grab the form wrapping the search bar.
|
||||
var url = form.attr('action');
|
||||
form.find('[name="c[]"] option').each(function(i, elem) {
|
||||
$(elem).attr('selected', true)
|
||||
})
|
||||
var formData = form.serialize();
|
||||
form.find('[name="c[]"] option').each(function(i, elem) {
|
||||
$(elem).attr('selected', false)
|
||||
})
|
||||
$.get(url, formData, function(data) { // perform an AJAX get, the trailing function is what happens on successful get.
|
||||
$("#query-result-list").html(data); // replace the "results" div with the result of action taken
|
||||
});
|
||||
});
|
||||
});
|
@ -1,29 +0,0 @@
|
||||
<% options = {} if options.nil? %>
|
||||
<%= javascript_tag do %>
|
||||
$('#<%= field_id %>').select2({
|
||||
ajax: {
|
||||
url: '<%= ajax_url %>',
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return { q: params.term };
|
||||
},
|
||||
processResults: function(data, params) {
|
||||
return { results: data };
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
placeholder: '<%= options[:placeholder].present? ? options[:placeholder] : ' ' %>',
|
||||
allowClear: <%= options[:allow_clear].present? && options[:allow_clear] ? 'true' : 'false' %>,
|
||||
minimumInputLength: 0,
|
||||
width: '60%',
|
||||
templateResult: formatState
|
||||
});
|
||||
|
||||
function formatState (opt) {
|
||||
if (opt.loading) return opt.name;
|
||||
var $opt = $('<span>' + opt.name_with_icon + '</span>');
|
||||
return $opt;
|
||||
};
|
||||
|
||||
<% end %>
|
31
app/views/additionals/_select2_ajax_call.js.slim
Normal file
31
app/views/additionals/_select2_ajax_call.js.slim
Normal file
@ -0,0 +1,31 @@
|
||||
- options = {} if options.nil?
|
||||
javascript:
|
||||
$("##{field_id}").select2({
|
||||
ajax: {
|
||||
url: "#{ajax_url}",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return {
|
||||
q: params.term
|
||||
};
|
||||
},
|
||||
processResults: function(data, params) {
|
||||
return {
|
||||
results: data
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
placeholder: "#{options[:placeholder].presence}",
|
||||
allowClear: #{options[:allow_clear].present? && options[:allow_clear] ? 'true' : 'false'},
|
||||
minimumInputLength: 0,
|
||||
width: '60%',
|
||||
templateResult: formatState
|
||||
});
|
||||
|
||||
function formatState(opt) {
|
||||
if (opt.loading) return opt.name;
|
||||
var $opt = $('<span>' + opt.name_with_icon + '</span>');
|
||||
return $opt;
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
<div id="month-calendar-<%= id %>" class="month-calendar"></div>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
$('#month-calendar-<%= id %>').datepicker({
|
||||
language: "<%= locale %>",
|
||||
calendarWeeks: <%= options[:show_weeks] %>,
|
||||
todayHighlight: true,
|
||||
multidate: true,
|
||||
disableTouchKeyboard: true,
|
||||
defaultViewDate: { year: <%= options[:year] %>, month: <%= options[:month] %>, day: 1 }
|
||||
});
|
||||
<% unless selected.empty? %>
|
||||
$('#month-calendar-<%= id %>').datepicker('setDates', <%= selected %>);
|
||||
<% end %>
|
||||
<% end %>
|
17
app/views/wiki/_calendar_macros.html.slim
Normal file
17
app/views/wiki/_calendar_macros.html.slim
Normal file
@ -0,0 +1,17 @@
|
||||
.month-calendar id="month-calendar-#{id}"
|
||||
javascript:
|
||||
$("#month-calendar-#{id}").datepicker({
|
||||
language: "#{locale}",
|
||||
calendarWeeks: #{options[:show_weeks]},
|
||||
todayHighlight: true,
|
||||
multidate: true,
|
||||
disableTouchKeyboard: true,
|
||||
defaultViewDate: {
|
||||
year: #{options[:year]},
|
||||
month: #{options[:month]},
|
||||
day: 1
|
||||
}
|
||||
});
|
||||
- unless selected.empty?
|
||||
javascript:
|
||||
$('#month-calendar-#{id}').datepicker('setDates', #{selected});
|
@ -1,16 +0,0 @@
|
||||
<div class="cryptocompare">
|
||||
<script type="text/javascript">
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
var embedder = scripts[ scripts.length - 1 ];
|
||||
(function (){
|
||||
var appName = encodeURIComponent(window.location.hostname);
|
||||
if(appName==""){appName="local";}
|
||||
var s = document.createElement("script");
|
||||
s.type = "text/javascript";
|
||||
s.async = true;
|
||||
var theUrl = '<%= raw url %>';
|
||||
s.src = theUrl + ( theUrl.indexOf("?") >= 0 ? "&" : "?") + "app=" + appName;
|
||||
embedder.parentNode.appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
</div>
|
16
app/views/wiki/_cryptocompare.html.slim
Normal file
16
app/views/wiki/_cryptocompare.html.slim
Normal file
@ -0,0 +1,16 @@
|
||||
.cryptocompare
|
||||
javascript:
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
var embedder = scripts[scripts.length - 1];
|
||||
(function() {
|
||||
var appName = encodeURIComponent(window.location.hostname);
|
||||
if (appName == "") {
|
||||
appName = "local";
|
||||
}
|
||||
var s = document.createElement("script");
|
||||
s.type = "text/javascript";
|
||||
s.async = true;
|
||||
var theUrl = "#{raw url}";
|
||||
s.src = theUrl + (theUrl.indexOf("?") >= 0 ? "&" : "?") + "app=" + appName;
|
||||
embedder.parentNode.appendChild(s);
|
||||
})();
|
Loading…
Reference in New Issue
Block a user