coffeescript

FineUploader responseJSON doesnt contain success in onComplete callback

萝らか妹 提交于 2020-01-07 05:35:07
问题 After getting the onComplete method to fire, I found that my responseJSON variable does not appear to contain the information I expected it to. Is this me screwing up somewhere(probably), or something not working quite right? FineUploader is recognizing a successful upload, so I know its getting the response, but when I log responseJSON in the onComplete, it prints "responseJSON: ". Just the file name. no braces, brackets, etc. Client Side Code uploader = new $("#collaboration-fine-uploader")

Rails 4 jQuery, javascript and coffee scripts not working

柔情痞子 提交于 2020-01-07 04:17:06
问题 I am new to rails and web development, although I have almost two decades of C/C++ in control systems and firmware, and quite a lot of shell and perl scripting. I can't get jquery to work without explicitly including it, even though it is in the application.js manifest, and I can't get any of the individual coffeescripts to work at all. Ubuntu 14.04LTS, ruby 2.2.1p85, rails 4.2.0 application.js //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . application

Authenticate user, redirect with XHR request

放肆的年华 提交于 2020-01-07 03:03:40
问题 I am looking at this guide to help me with setting up a "Add to Cart" feature within my application. Within the guide the author only allows a user to add to the basket if they are signed in (which also means the button is not visible until this point), however I don't want to be restricted by this, so the "Add to Cart" would always be visible, but when clicking if you are not logged in then you would be redirected to the login/signup page. Within the controller we are using the before_filter

Hammer for mac(HTML网站编辑制作工具)

ε祈祈猫儿з 提交于 2020-01-07 02:45:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Hammer Mac激活版 是一款非常强大的HTML网站编辑制作工具。Hammer具有包括HTML、SASS和Coffeescript路径解析支持的功能。更多Mac软件获取,来 Mac软件下载平台Macdown 探索一番吧! Hammer for mac破解版下载 https://www.macdown.com/mac/5601.html Hammer for Mac软件介绍 Hammer是建立HTML网站的好方法。通过HTML包括,SASS和CoffeeScript解析和巧妙的路径等功能,Hammer是不可或缺的工具!锤子有一些内置的功能自动发生,一些聪明的功能,你用特殊的锤标签。 功能介绍 HTML包括 - 前端开发人员不应该运行本地服务器环境,或使用PHP只是将一个HTML文件放在另一个。锤子,你不必。 聪明的路径 - 如果你可以仅仅通过名字来引用一个资产,这不是很好吗?Hammer将在您的项目中搜索您参考的文件,并自动为您写入文件路径。 变量+助手 - 在你的模板文件中设置和使用变量,并根据你的意愿弯曲你的模板。Hammer还为您的HTML链接标签添加了有用的类,使菜单逻辑成为过去。 自动重新加载 - 每次Hammer完成编译项目时,它都会自动刷新浏览器以显示最新的更改并保持最新状态。 SASS +

Turn Coffeescript loop using range into ES6

落爺英雄遲暮 提交于 2020-01-07 02:28:12
问题 Disclaimer : I don't know Coffeescript and, although I appreciate it has contributed towards the ES6 spec, I can't wait to see the back it. This Coffeescript loop (wrote by someone else) if @props.total>1 for page in [1..@props.total] active = (page is +@props.current) is, according to js2coffee, equivalent to this JS var active, i, page, ref; if (this.props.total > 1) { for (page = i = 1, ref = this.props.total; 1 <= ref ? i <= ref : i >= ref; page = 1 <= ref ? ++i : --i) { active = page ===

observableArray bound table does not update when inside a jQuery UI dialog

不想你离开。 提交于 2020-01-06 23:55:49
问题 I'm trying to create a page with a button which, when clicked, opens a modal dialog box that allows a user to search for products and add selected search results to an order. I've created what I thought would work (jsfiddle sample), however the search results table, which is bound to an observableArray , does not update. If I remove the data-bind attribute from the <div id="myDialog"/> then the search results table updates correctly. Also, I could only get the jsfiddle sample to repeat the

jQuery remove click event handler from an element

一世执手 提交于 2020-01-06 19:48:31
问题 I have this event handler, $('#table_product').on 'click', '.th1',(event) -> $(this).unbind("click") #Not working What I'm trying to achieve is when a user triggers this event, it will disable/detach the click event handler from .th1 . So it won't give any response to the user for the next request. Currently, I have tried unbind() and off() , but still no luck.. Any other suggestion ? 回答1: First, it could be useful if you give us more code, so we can test the code easily. From the API of

Coffeescript dynamically create/call a function from a list on select box value change

99封情书 提交于 2020-01-06 19:41:32
问题 I'm working on adding some image editing tools using the Pixastic library. The idea is that the user can choose an aspect of the image or tool they want from a select box, then the tool will show up below the select box (I'm using select2) and the user can edit via a slider. Here's what I have so far: # This seeds the select2 options list imageToolsList = [ {id: 'bl', text: 'Blur'} {id: 'bc', text: 'Brightness/Contrast'} {id: 'ca', text: 'Color Adjust (RGB)'} ... ] #Creates a select box and

CoffeeScript for loop get iterator var

喜欢而已 提交于 2020-01-06 12:41:14
问题 In coffescript I have arr = ["a","b","c"] for i in [0..arr.length] by 1 if (sometimesTrue) arr.pop() i-- But it is translating it to this: var arr, i, _i, _ref; arr = ["a", "b", "c"]; for (i = _i = 0, _ref = arr.length; _i <= _ref; i = _i += 1) { if (sometimesTrue) { arr.pop(); i--; } } You can see that this loop uses a _i as the reference rather than i so my i-- doesn't really do anything. Since in this loop, the length of the array changes, I sort of need to figure out how to handle this...

Application.js.coffee rails

做~自己de王妃 提交于 2020-01-06 08:22:06
问题 I am trying to do an autocomplete from jQuery, however the code that I have is in CoffeeScript. I am not to sure how to run it on my localhost server. At first I placed it in application.js but that doesn't work, so then I created gens.js.coffee and placed the code there, but still doesn't show. Here is the code: jQuery -> $('#querysearch').autocomplete source: ['foo', 'food', 'four'] Here application.js is calling the file: //= require gens //= require jQuery.ui.datepicker # file his