id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gterrono/houston:client/collection_view.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.houston-home": function(e) {
return Houston._go('home');
},
"click a.houston-sort":... | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == this.toString())
Houston._session('sort_order', Ho... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 446fa960c31d33c521b881308100a6ac27b904d0 | 802 | https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/collection_view.coffee | 66 | 115 |
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == this.toString())
Houston._session('sort_order', Ho... | field_name = $this.data('field')
update_dict = {}
update_dict[field_name] = updated_val
Meteor.call("_houston_#{Houston._session('collection_name')}_update",
id, $set: update_dict)
'keyup .houston-column-filter': (e) ->
field_selectors = {}
$('.houston-column-filter').each (idx, ite... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 446fa960c31d33c521b881308100a6ac27b904d0 | 802 | https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/collection_view.coffee | 66 | 115 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | e.preventDefault()
$create_row = $('#houston-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. foods.app -> {foods: {app:}})
keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_doc
for key in keys
... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 446fa960c31d33c521b881308100a6ac27b904d0 | 802 | https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/collection_view.coffee | 116 | 135 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | e.preventDefault()
$create_row = $('#houston-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. foods.app -> {foods: {app:}})
keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_doc
for key in keys | doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "_houston_#{Houston._session('collection_name')}_insert", new_doc
'submit form.houston-filter-form': (e) ->
e.preventDefault() | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 446fa960c31d33c521b881308100a6ac27b904d0 | 802 | https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/collection_view.coffee | 116 | 135 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | e.preventDefault()
console.log 'create doc'
$create_row = $('#houston-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. foods.app -> {foods: {app:}})
keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fcbce27a54c7e260d1a600a46ac7951f3acb6cd3 | 802 | https://github.com/gterrono/houston/blob/fcbce27a54c7e260d1a600a46ac7951f3acb6cd3/client/collection_view.coffee | 116 | 136 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | e.preventDefault()
console.log 'create doc'
$create_row = $('#houston-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. foods.app -> {foods: {app:}})
keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_... | for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "_houston_#{Houston._session('collection_name')}_insert", new_doc
'submit form.houston-filter-form': (e) ->
e.preventDefault() | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fcbce27a54c7e260d1a600a46ac7951f3acb6cd3 | 802 | https://github.com/gterrono/houston/blob/fcbce27a54c7e260d1a600a46ac7951f3acb6cd3/client/collection_view.coffee | 116 | 136 |
gterrono/houston:client/collection_view.coffee:2:raw_corpus | raw_corpus | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Houston._session(session_key)?
for key, val of Houston._session(session_... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 6 | 17 | ||
gterrono/houston:client/collection_view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Houston._session(se... | var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_query_with_regex = function(session_key) {
var key, re... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_que... | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Houston._session(session_key)?
for key, val of Houston._session(session_... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:completion | completion | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Houston._session(session_key)? | for key, val of Houston._session(session_key)
# From http://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript#answer-9310752
query[key] = $regex: val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
fill_query_with_regex('top_selector')
fill_query_with_r... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:3:raw_corpus | raw_corpus | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Houston._session('collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_filt... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 19 | 26 | ||
gterrono/houston:client/collection_view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Houston._session('collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWithPa... | var resubscribe;
resubscribe = function() {
var subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
subscription_name = `_houston_${Houston._session('collection_name')}`;
Houston._paginated_subscription.stop();
return Houston._paginated_subscription = Meteor.subscribeWith... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var resubscribe;
resubscribe = function() {
var subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
subscription_name = `_houston_${Houston._session('collection_name')}`;
Houston._paginated_subscription.stop();
return... | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Houston._session('collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_filt... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:3:completion | completion | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Houston._session('collection_name')}"
Houston._paginated_subscription.stop() | Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_filter_query(),
Houston._admin_page_length | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:5:raw_corpus | raw_corpus | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 30 | 59 | ||
gterrono/houston:client/collection_view.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/hous... | var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields().slice(1);
},
name: function() {
ret... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_vi... | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:5:completion | completion | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | d.collection = collection
d._id = d._id._str or d._id
return d
values_in_order: ->
fields_in_order = get_collection_view_fields()
names_in_order = _.clone fields_in_order
values = (Houston._nested_field_lookup(@, field_name) for field_name in fields_in_order[1..]) # skip _id
({field_value... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == this.toString())
Houston._session('sort_order', Ho... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 69 | 118 | ||
gterrono/houston:client/collection_view.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == t... | var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.houston-home": function(e) {
return Houston._go('home');
},
"click a.houston-sort": function(e) {
e.preventDefault();
if (Houston.... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 69 | 118 |
gterrono/houston:client/collection_view.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.houston-home": function(e) {
return Houston._go('home');
},
"click a.houston-sort":... | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == this.toString())
Houston._session('sort_order', Ho... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 69 | 118 |
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Houston._go 'home'
"click a.houston-sort": (e) ->
e.preventDefault()
if (Houston._session('sort_key') == this.toString())
Houston._session('sort_order', Ho... | $this = $(e.currentTarget)
$this.removeClass('houston-collection-field')
$this.html "<input type='text' value='#{$this.text()}'>"
$this.find('input').select()
$this.find('input').on 'blur', ->
updated_val = $this.find('input').val()
$this.html updated_val
$this.addClass('houston-collec... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 69 | 118 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | id = $(e.currentTarget).data('id')
Meteor.call "_houston_#{Houston._session('collection_name')}_delete", id
'click .houston-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field name... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 119 | 142 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | id = $(e.currentTarget).data('id')
Meteor.call "_houston_#{Houston._session('collection_name')}_delete", id
'click .houston-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field name... | doc_iter = new_doc
for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "_houston_#{Houston._session('collection_name')}_insert", new_doc
'submit form.houston-filter-form': (e) ->
e.... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 3fa4b927aee4e23c39e194ee4e97fadbf627c39c | 802 | https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/client/collection_view.coffee | 119 | 142 |
gterrono/houston:client/collection_view.coffee:5:raw_corpus | raw_corpus | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 16ea359dbf8dfec50191fb5cf8c98d6c81120457 | 802 | https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/collection_view.coffee | 30 | 59 | ||
gterrono/houston:client/collection_view.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/hous... | var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields().slice(1);
},
name: function() {
ret... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 16ea359dbf8dfec50191fb5cf8c98d6c81120457 | 802 | https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_vi... | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 16ea359dbf8dfec50191fb5cf8c98d6c81120457 | 802 | https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:5:completion | completion | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
name: -> "#{Houston._session('collection_name')}"
document_url: -> "/houston/#{Houston._session('collection_name')}/#{@_id}"
doc... | d.collection = collection
d._id = d._id._str or d._id
return d
values_in_order: ->
fields_in_order = get_collection_view_fields()
names_in_order = _.clone fields_in_order
values = (Houston._lookup(@, field_name) for field_name in fields_in_order[1..]) # skip _id
({field_value, field_name}... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 16ea359dbf8dfec50191fb5cf8c98d6c81120457 | 802 | https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/collection_view.coffee | 30 | 59 |
gterrono/houston:client/collection_view.coffee:1:raw_corpus | raw_corpus | get_sort_by = ->
sort_by = {}
sort_by[Session.get('key')] = Session.get('sort_order')
return sort_by | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 1 | 4 | ||
gterrono/houston:client/collection_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_sort_by = ->
sort_by = {}
sort_by[Session.get('key')] = Session.get('sort_order')
return sort_by
``` | var get_sort_by;
get_sort_by = function() {
var sort_by;
sort_by = {};
sort_by[Session.get('key')] = Session.get('sort_order');
return sort_by;
}; | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_sort_by;
get_sort_by = function() {
var sort_by;
sort_by = {};
sort_by[Session.get('key')] = Session.get('sort_order');
return sort_by;
};
``` | get_sort_by = ->
sort_by = {}
sort_by[Session.get('key')] = Session.get('sort_order')
return sort_by | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:1:completion | completion | get_sort_by = ->
sort_by = {} | sort_by[Session.get('key')] = Session.get('sort_order')
return sort_by | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:2:raw_corpus | raw_corpus | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 6 | 17 | ||
gterrono/houston:client/collection_view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session... | var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_query_with_regex = function(session_key) {
var key, re... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_que... | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:completion | completion | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)? | for key, val of Session.get(session_key)
# From http://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript#answer-9310752
query[key] = $regex: val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
fill_query_with_regex('top_selector')
fill_query_with_regex(... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:3:raw_corpus | raw_corpus | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window # TODO find a better global object
subscription_name = "admin_#{Session.get('collection_name')}"
COLLECTION_STORAGE.inspector_subscription.stop()
COLLECTION_STORAGE.inspector_subscription =
Me... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 19 | 27 | ||
gterrono/houston:client/collection_view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window # TODO find a better global object
subscription_name = "admin_#{Session.get('collection_name')}"
COLLECTION_STORAGE.inspector_subscription.st... | var resubscribe;
resubscribe = function() {
var COLLECTION_STORAGE, subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window; // TODO find a better global object
subscription_name = `admin_${Session.get('collection_name')}`;
COLLECTION_STORAGE.inspe... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 19 | 27 |
gterrono/houston:client/collection_view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var resubscribe;
resubscribe = function() {
var COLLECTION_STORAGE, subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window; // TODO find a better global object
subscription_name = `admin_${Sessi... | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window # TODO find a better global object
subscription_name = "admin_#{Session.get('collection_name')}"
COLLECTION_STORAGE.inspector_subscription.stop()
COLLECTION_STORAGE.inspector_subscription =
Me... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 19 | 27 |
gterrono/houston:client/collection_view.coffee:3:completion | completion | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
COLLECTION_STORAGE = window # TODO find a better global object
subscription_name = "admin_#{Session.get('collection_name')}" | COLLECTION_STORAGE.inspector_subscription.stop()
COLLECTION_STORAGE.inspector_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_filter_query(),
COLLECTION_STORAGE.admin_page_length | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 19 | 27 |
gterrono/houston:client/collection_view.coffee:5:raw_corpus | raw_corpus | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 31 | 55 | ||
gterrono/houston:client/collection_view.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#... | var collection_count;
collection_count = function() {
return collection_info().count;
};
Template.collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields().slice(1);
},
collection_name: function() {
r... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 31 | 55 |
gterrono/houston:client/collection_view.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var collection_count;
collection_count = function() {
return collection_info().count;
};
Template.collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields... | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 31 | 55 |
gterrono/houston:client/collection_view.coffee:5:completion | completion | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | get_current_collection()?.find(get_filter_query(), {sort: get_sort_by()}).fetch()
values_in_order: ->
fields_in_order = get_collection_view_fields()
names_in_order = _.clone fields_in_order
values = (lookup(@, field_name) for field_name in fields_in_order[1..]) # skip _id
({value, name} for [value, n... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 31 | 55 |
gterrono/houston:client/collection_view.coffee:6:raw_corpus | raw_corpus | Template.collection_view.rendered = ->
$win = $(window)
$win.scroll ->
if $win.scrollTop() + 300 > $(document).height() - $win.height() and
window.inspector_subscription.limit() < collection_count()
window.inspector_subscription.loadNextPage() | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 57 | 62 | ||
gterrono/houston:client/collection_view.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template.collection_view.rendered = ->
$win = $(window)
$win.scroll ->
if $win.scrollTop() + 300 > $(document).height() - $win.height() and
window.inspector_subscription.limit() < collection_count()
window.inspector_subscription.loadNextPage... | Template.collection_view.rendered = function() {
var $win;
$win = $(window);
return $win.scroll(function() {
if ($win.scrollTop() + 300 > $(document).height() - $win.height() && window.inspector_subscription.limit() < collection_count()) {
return window.inspector_subscription.loadNextPage();
}
});... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 57 | 62 |
gterrono/houston:client/collection_view.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Template.collection_view.rendered = function() {
var $win;
$win = $(window);
return $win.scroll(function() {
if ($win.scrollTop() + 300 > $(document).height() - $win.height() && window.inspector_subscription.limit() < collection_count()) {
return wi... | Template.collection_view.rendered = ->
$win = $(window)
$win.scroll ->
if $win.scrollTop() + 300 > $(document).height() - $win.height() and
window.inspector_subscription.limit() < collection_count()
window.inspector_subscription.loadNextPage() | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 57 | 62 |
gterrono/houston:client/collection_view.coffee:6:completion | completion | Template.collection_view.rendered = ->
$win = $(window)
$win.scroll -> | if $win.scrollTop() + 300 > $(document).height() - $win.height() and
window.inspector_subscription.limit() < collection_count()
window.inspector_subscription.loadNextPage() | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 57 | 62 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 65 | 114 | ||
gterrono/houston:client/collection_view.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set(... | var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template.collection_view.events({
"click a.home": function(e) {
return houston_go('home');
},
"click a.sort": function(e) {
e.preventDefault();
if (Session.get('key') === this.toStri... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template.collection_view.events({
"click a.home": function(e) {
return houston_go('home');
},
"click a.sort": function(e) {
e.preve... | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | $this = $(e.currentTarget)
$this.removeClass('collection-field')
$this.html "<input type='text' value='#{$this.text()}'>"
$this.find('input').select()
$this.find('input').on 'blur', ->
updated_val = $this.find('input').val()
$this.html updated_val
$this.addClass('collection-field')
... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | $('#create-btn').hide()
'click .admin-delete-doc': (e) ->
e.preventDefault()
id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for fi... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 115 | 145 | ||
gterrono/houston:client/collection_view.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$('#create-btn').hide()
'click .admin-delete-doc': (e) ->
e.preventDefault()
id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create... | $('#create-btn').hide()({
'click .admin-delete-doc': function(e) {
var id;
e.preventDefault();
id = $(e.currentTarget).data('id');
return Meteor.call(`admin_${Session.get('collection_name')}_delete`, id);
},
'click .admin-create-doc': function(e) {
var $create_row, doc_iter, field, final_key, ... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 115 | 145 |
gterrono/houston:client/collection_view.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$('#create-btn').hide()({
'click .admin-delete-doc': function(e) {
var id;
e.preventDefault();
id = $(e.currentTarget).data('id');
return Meteor.call(`admin_${Session.get('collection_name')}_delete`, id);
},
'click .admin-create-doc': function... | $('#create-btn').hide()
'click .admin-delete-doc': (e) ->
e.preventDefault()
id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for fi... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 115 | 145 |
gterrono/houston:client/collection_view.coffee:9:completion | completion | $('#create-btn').hide()
'click .admin-delete-doc': (e) ->
e.preventDefault()
id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for fi... | doc_iter = new_doc
for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "admin_#{Session.get('collection_name')}_insert", new_doc
'click #admin-load-more': (e) ->
window.inspector_su... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea | 802 | https://github.com/gterrono/houston/blob/fd4a1cd379829fb21c6f02b9026e0228ccfdc0ea/client/collection_view.coffee | 115 | 145 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 65 | 114 | ||
gterrono/houston:client/collection_view.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set(... | var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template.collection_view.events({
"click a.home": function(e) {
return houston_go('home');
},
"click a.sort": function(e) {
e.preventDefault();
if (Session.get('key') === this.toStri... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template.collection_view.events({
"click a.home": function(e) {
return houston_go('home');
},
"click a.sort": function(e) {
e.preve... | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | $this = $(e.currentTarget)
$this.removeClass('collection-field')
$this.html "<input type='text' value='#{$this.text()}'>"
$this.find('input').select()
$this.find('input').on 'blur', ->
updated_val = $this.find('input').val()
$this.html updated_val
$this.addClass('collection-field')
... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 65 | 114 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. fo... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 115 | 141 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. fo... | for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "admin_#{Session.get('collection_name')}_insert", new_doc
'click #admin-load-more': (e) ->
window.inspector_subscription.loadNextPage()... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 6001037804ec3868e7e3264e10fb6ee9c2dc0761 | 802 | https://github.com/gterrono/houston/blob/6001037804ec3868e7e3264e10fb6ee9c2dc0761/client/collection_view.coffee | 115 | 141 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. fo... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | e652379d68f6c94ff5ac4cd9f4dccafc62c185cf | 802 | https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/client/collection_view.coffee | 115 | 142 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | id = $(e.currentTarget).data('id')
Meteor.call "admin_#{Session.get('collection_name')}_delete", id
'click .admin-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field names (e.g. fo... | doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
debugger
Meteor.call "admin_#{Session.get('collection_name')}_insert", new_doc
'click #admin-load-more': (e) ->
window.inspector_subscription.loadNextPage()
'submit... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | e652379d68f6c94ff5ac4cd9f4dccafc62c185cf | 802 | https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/client/collection_view.coffee | 115 | 142 |
gterrono/houston:client/collection_view.coffee:2:raw_corpus | raw_corpus | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 6 | 16 | ||
gterrono/houston:client/collection_view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session... | var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_query_with_regex = function(session_key) {
var key, re... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 6 | 16 |
gterrono/houston:client/collection_view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_que... | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 6 | 16 |
gterrono/houston:client/collection_view.coffee:2:completion | completion | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) -> | return unless Session.get(session_key)?
for key, val of Session.get(session_key)
# From http://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript#answer-9310752
query[key] = $regex: val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
fill_query_with_re... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 6 | 16 |
gterrono/houston:client/collection_view.coffee:5:raw_corpus | raw_corpus | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 30 | 52 | ||
gterrono/houston:client/collection_view.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#... | var collection_count;
collection_count = function() {
return collection_info().count;
};
Template.collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields().slice(1);
},
collection_name: function() {
r... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 30 | 52 |
gterrono/houston:client/collection_view.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var collection_count;
collection_count = function() {
return collection_info().count;
};
Template.collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields... | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 30 | 52 |
gterrono/houston:client/collection_view.coffee:5:completion | completion | collection_count = -> collection_info().count
Template.collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('collection_name')}"
document_url: -> "/admin/#{Session.get('collection_name')}/#{@_id}"
document_id: ... | rows: ->
get_current_collection()?.find(get_filter_query(), {sort: get_sort_by()}).fetch()
values_in_order: ->
fields_in_order = get_collection_view_fields()
names_in_order = _.clone fields_in_order
values = (lookup(@, field_name) for field_name in fields_in_order[1..]) # skip _id
({value, name} ... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 30 | 52 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 62 | 111 | ||
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template.collection_view.events
"click a.home": (e) ->
houston_go 'home'
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('key') == this.toString())
Session.set('sort_order', Session.get('sort_order') * - 1)
else... | field_name = $this.data('field')
update_dict = {}
update_dict[field_name] = updated_val
Meteor.call("admin_#{Session.get('collection_name')}_update",
id, $set: update_dict)
'keyup .column_filter': (e) ->
field_selectors = {}
$('.column_filter').each (idx, item) ->
if item.valu... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 62 | 111 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_doc
for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "admin_#{Session.get('collection_name')}_insert", ne... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 112 | 129 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | keys = field.name.split('.')
final_key = keys.pop()
doc_iter = new_doc
for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value | field.value = ''
Meteor.call "admin_#{Session.get('collection_name')}_insert", new_doc
'click #admin-load-more': (e) ->
window.inspector_subscription.loadNextPage()
'submit form': (e) ->
e.preventDefault() | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | ba6c723092fb3f35eb69a4a33e76b399ef118dae | 802 | https://github.com/gterrono/houston/blob/ba6c723092fb3f35eb69a4a33e76b399ef118dae/client/collection_view.coffee | 112 | 129 |
gterrono/houston:client/collection_view.coffee:1:raw_corpus | raw_corpus | get_sort_by = ->
sort_by = {}
sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order')
return sort_by | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 1 | 4 | ||
gterrono/houston:client/collection_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_sort_by = ->
sort_by = {}
sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order')
return sort_by
``` | var get_sort_by;
get_sort_by = function() {
var sort_by;
sort_by = {};
sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order');
return sort_by;
}; | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_sort_by;
get_sort_by = function() {
var sort_by;
sort_by = {};
sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order');
return sort_by;
};
``` | get_sort_by = ->
sort_by = {}
sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order')
return sort_by | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:1:completion | completion | get_sort_by = ->
sort_by = {} | sort_by[Session.get('_houston_sort_key')] = Session.get('_houston_sort_order')
return sort_by | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 1 | 4 |
gterrono/houston:client/collection_view.coffee:2:raw_corpus | raw_corpus | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 6 | 17 | ||
gterrono/houston:client/collection_view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session... | var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_query_with_regex = function(session_key) {
var key, re... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_filter_query;
get_filter_query = function() {
var fill_query_with_regex, query;
// Make find query using the filter stored in the session. The regexes are
// escaped, but $regex is used so it can match anywhere in the string.
query = {};
fill_que... | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)?
for key, val of Session.get(session_key)
... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:2:completion | completion | get_filter_query = ->
# Make find query using the filter stored in the session. The regexes are
# escaped, but $regex is used so it can match anywhere in the string.
query = {}
fill_query_with_regex = (session_key) ->
return unless Session.get(session_key)? | for key, val of Session.get(session_key)
# From http://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript#answer-9310752
query[key] = $regex: val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
fill_query_with_regex('_houston_top_selector')
fill_query_wi... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 6 | 17 |
gterrono/houston:client/collection_view.coffee:3:raw_corpus | raw_corpus | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Session.get('_houston_collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 19 | 26 | ||
gterrono/houston:client/collection_view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Session.get('_houston_collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWi... | var resubscribe;
resubscribe = function() {
var subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
subscription_name = `_houston_${Session.get('_houston_collection_name')}`;
Houston._paginated_subscription.stop();
return Houston._paginated_subscription = Meteor.subscribe... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var resubscribe;
resubscribe = function() {
var subscription_name;
// Stop the old subscription and resubscribe with the new filter/sort
subscription_name = `_houston_${Session.get('_houston_collection_name')}`;
Houston._paginated_subscription.stop();
re... | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Session.get('_houston_collection_name')}"
Houston._paginated_subscription.stop()
Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:3:completion | completion | resubscribe = ->
# Stop the old subscription and resubscribe with the new filter/sort
subscription_name = "_houston_#{Session.get('_houston_collection_name')}"
Houston._paginated_subscription.stop() | Houston._paginated_subscription =
Meteor.subscribeWithPagination subscription_name,
get_sort_by(), get_filter_query(),
Houston._admin_page_length | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 19 | 26 |
gterrono/houston:client/collection_view.coffee:5:raw_corpus | raw_corpus | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('_houston_collection_name')}"
document_url: -> "/houston/#{Session.get('_houston_collection_nam... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 30 | 54 | ||
gterrono/houston:client/collection_view.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('_houston_collection_name')}"
document... | var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_view_fields().slice(1);
},
collection_name: function(... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 30 | 54 |
gterrono/houston:client/collection_view.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var collection_count;
collection_count = function() {
return collection_info().count;
};
Template._houston_collection_view.helpers({
headers: function() {
return get_collection_view_fields();
},
nonid_headers: function() {
return get_collection_vi... | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('_houston_collection_name')}"
document_url: -> "/houston/#{Session.get('_houston_collection_nam... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 30 | 54 |
gterrono/houston:client/collection_view.coffee:5:completion | completion | collection_count = -> collection_info().count
Template._houston_collection_view.helpers
headers: -> get_collection_view_fields()
nonid_headers: -> get_collection_view_fields()[1..]
collection_name: -> "#{Session.get('_houston_collection_name')}"
document_url: -> "/houston/#{Session.get('_houston_collection_nam... | get_current_collection()?.find(get_filter_query(), {sort: get_sort_by()}).fetch()
values_in_order: ->
fields_in_order = get_collection_view_fields()
names_in_order = _.clone fields_in_order
values = (Houston._lookup(@, field_name) for field_name in fields_in_order[1..]) # skip _id
({value, name} for ... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 30 | 54 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Meteor.go("/houston/")
"click a.houston-sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_key') == this.toString())
Session.set('_houston_sor... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 64 | 113 | ||
gterrono/houston:client/collection_view.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Meteor.go("/houston/")
"click a.houston-sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_ke... | var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.houston-home": function(e) {
return Meteor.go("/houston/");
},
"click a.houston-sort": function(e) {
e.preventDefault();
if (Sessi... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 64 | 113 |
gterrono/houston:client/collection_view.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.houston-home": function(e) {
return Meteor.go("/houston/");
},
"click a.houston-sor... | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Meteor.go("/houston/")
"click a.houston-sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_key') == this.toString())
Session.set('_houston_sor... | JavaScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 64 | 113 |
gterrono/houston:client/collection_view.coffee:8:completion | completion | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.houston-home": (e) ->
Meteor.go("/houston/")
"click a.houston-sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_key') == this.toString())
Session.set('_houston_sor... | $this = $(e.currentTarget)
$this.removeClass('houston-collection-field')
$this.html "<input type='text' value='#{$this.text()}'>"
$this.find('input').select()
$this.find('input').on 'blur', ->
updated_val = $this.find('input').val()
$this.html updated_val
$this.addClass('houston-collec... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 64 | 113 |
gterrono/houston:client/collection_view.coffee:9:raw_corpus | raw_corpus | id = $(e.currentTarget).data('id')
Meteor.call "_houston_#{Session.get('_houston_collection_name')}_delete", id
'click .houston-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field ... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 114 | 137 | ||
gterrono/houston:client/collection_view.coffee:9:completion | completion | id = $(e.currentTarget).data('id')
Meteor.call "_houston_#{Session.get('_houston_collection_name')}_delete", id
'click .houston-create-doc': (e) ->
e.preventDefault()
$create_row = $('#admin-create-row')
new_doc = {}
for field in $create_row.find('input[type="text"]')
# Unflatten the field ... | doc_iter = new_doc
for key in keys
doc_iter[key] = {} unless doc_iter[key]
doc_iter = doc_iter[key]
doc_iter[final_key] = field.value
field.value = ''
Meteor.call "_houston_#{Session.get('_houston_collection_name')}_insert", new_doc
'submit form.houston-filter-form': (e) ->
... | CoffeeScript | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 41054775b787b09d7539867351cc23eb0705b4c8 | 802 | https://github.com/gterrono/houston/blob/41054775b787b09d7539867351cc23eb0705b4c8/client/collection_view.coffee | 114 | 137 |
gterrono/houston:client/collection_view.coffee:8:raw_corpus | raw_corpus | get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.home": (e) ->
Meteor.go("/houston/")
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_key') == this.toString())
Session.set('_houston_sort_order', Sessio... | CoffeeScript | gterrono/houston | client/collection_view.coffee | MIT | 93e06a251afa99843d47e26f6bfde1ba3c93c47e | 802 | https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/collection_view.coffee | 64 | 113 | ||
gterrono/houston:client/collection_view.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
get_collection_view_fields = -> collection_info().fields or []
Template._houston_collection_view.events
"click a.home": (e) ->
Meteor.go("/houston/")
"click a.sort": (e) ->
e.preventDefault()
if (Session.get('_houston_sort_key') == this.toSt... | var get_collection_view_fields;
get_collection_view_fields = function() {
return collection_info().fields || [];
};
Template._houston_collection_view.events({
"click a.home": function(e) {
return Meteor.go("/houston/");
},
"click a.sort": function(e) {
e.preventDefault();
if (Session.get('_houston... | CoffeeScript | JavaScript | gterrono/houston | client/collection_view.coffee | MIT | 93e06a251afa99843d47e26f6bfde1ba3c93c47e | 802 | https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/collection_view.coffee | 64 | 113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.