Graphic view with sproutcore - sproutcore

I'm starting with sproutcore and todos tutorial. My output is on picture below
I'm using chromium browser (linux). Sproutcore theme doesn't support this browser?
Or how can I fixed it?
Thanks.

In your Buildfile, try to add :use_sprites => false.
Here is an example:
config :your_app,
:title => 'Your app',
:theme => 'sproutcore/ace',
:use_sprites => false
I think it's because of a bug with abbot when it combines images.
And don't forget to reload sc_server ;-)

Related

Typo3 Fluid detect Links in Text

This Code is showing a Textarea Input from the Backend in my Frontend:
<f:format.nl2br>{data.textfield}</f:format.nl2br>
Its possible there are Links in it as simple text for example:
http://www.example.com
Is it possible somehow to detect those links and wrap a linktag around it with Typo3 6 and Fluid?
Its rather easy in Javascript but if possible I prefer a Typo3/Fluid solution here.
why dont you use the RTE for your Textfield in the Backend and render it in Fluid with
<f:format.html>{data.textfield}</f:format.html>
If you do it like this, you have your line breaks rendered and all the Links, too. You enable the RTE features in your TCA-Configuration:
'textarea' => array(
'exclude' => 0,
'label' => 'your_label_from_locallang.xlf',
'config' => array(
'type' => 'text',
'cols' => 40,
'rows' => 15
),
'defaultExtras' => 'richtext[]'
),
Is the fluid used in context of an extension? If so make the check on php side and bind a boolean value to the view. You can then use something like this:
<f:if condition="isLink">
<f:then>
<f:link.external uri="{data.textfield}" target="_blank">{data.textfield}</f:link.external>
</f:then>
<f:else>
<f:format.nl2br>{data.textfield}</f:format.nl2br>
</f:else>
</f:if>
Unfortunately condition is very limited in what it can check on fluid side only so this won't help if you can't use php.
Another possibility would be to create a ViewHelper for that.

Setting hint text in a text field in Ruby on Rails

Can some one suggest the best way for setting hint text(not default text) for a text field in Ruby on Rails. Currently I am using this:
<%= text_field_with_auto_complete
"customer",
:contact_person, {
:value => 'last, first',
:style => 'color:#aaa;width:11em;',
:onfocus => "if(this.getValue()=='last, first'){this.clear();this.style.color = '#000';}",
:onblur => "if(this.getValue()==''){this.setValue('last, first');this.style.color = #aaa';}"
} %>
The text field is attached to a model and in turn to a value in a database. Also, the same html that is used in index.html is also used in edit.html and hence when I try to edit the field, the default value shows up instead of the value from the database. What is the correct way to do this?
Note: I am not trying to set a default value but just a hint to what needs to be entered in the text box.
Thanks,
Raja Ram
I'd recommend using the HTML 5 placeholder attribute, and then using a jQuery plugin to make it work on older browsers (like this one, but there are many others on Google).
You can see this technique used in production here.
Try this jquery plugin
http://plugins.jquery.com/project/hint
or choose here:
http://plugins.jquery.com/plugin-tags/hint
For prototype
http://davidchambersdesign.com/autopopulating-input-fields-with-prototype/

Prototype Rails3 Autocomplete not displaying properly in IE8

In my rails3 project, I had to implement a simple text field, a div and a autocomplete helper in my view file. auto complete works well in all browsers except IE. the div element in which the results fall in keeps changing its style attribute. here is the code.
.. #form related other code
<%= text_field_tag('location') %>
<div id="location_auto_complete" class="auto_complete"> </div>
<%= auto_complete_field('location', :url => locations_path(), :indicator => 'locations_indicator', :select => 'value') %>
it works perfect in all browsers. but in IE, the auto suggestions box dislocates itself to some other part in the page. style attribute is added dynamically to that div element everytime there is a response from server.
I am using the latest fork of rails autocomplete plugin https://github.com/fidel/auto_complete . Please help, I am stuck with this problem for hours.
I ran into this same problem. Apparently it is a problem with Prototype's getOffsetParent function and IE8:
https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/618-getoffsetparent-returns-body-for-new-hidden-elements-in-ie8-final#ticket-618-9
Pretty embarrassing for Prototype actually that this still hasn't been fixed since that thread is from March 2009.
Anyway, as someone in that thread mentions, you can edit your prototype.js file and change the first line of getOffsetParent to this:
getOffsetParent: function(element) {
if (element.offsetParent && Element.visible(element)) return $(element.offsetParent);
...
The && Element.visible(element) is the new part. This fixed it for me. Make sure to do a hard refresh (shift-reload) in IE8 so it picks up the new JS after your changes.

Is it possible to drag and drop an element from a different page to a Droppable?

I am trying to get the following requirement to work. I have a test page that has a Droppable area.
<%= drop_receiving_element(
"basket",
:onDrop => "function(element) { alert(element) }",
:url => { :action => "create" }
)%>
What I want to achieve, is to be able to drop any links from another browser tab/window onto the Droppable and record that link. Bear in mind that these links will be arbitrary and out of my control so I can't decorate them as Draggable. Is this achievable or am I barking up the wrong tree?
TIA
Not possible I'm afraid. Two browsers = two doms. Maybe possible with google gears, silverlight, and java but not js.
http://www.w3schools.com/htmldom/default.asp

Passing large amounts of Template Code into a variable?

I'm using the following to populate a series of markers on a Google map in Rails:
marker = GMarker.new(coords, :icon => home, :title => "home", :info_window => "Info Text Goes Here" )
I'm trying to customize the info window beyond the text and trying to pass a lot of info into it, but I'm not sure exactly how to do it beyond making a really long annoying string. What's the best strategy to pass a lot of formatted info in HTML/CSS? Partials of some sort?
Ahh well, I can't yet comment, but Andrew's code should work on the View, but not in your controller.
It all depends on how your are constructing your Google map markers. If you are generating them in your controller, you'll want to create a function that will return the text for you and pass that to your GMarker object.
If you are creating them via Javascript in the view, then you'll want to use a partial to load the information in.
Perhaps describe the problem further.
Anyway, Sorry to clutter up the answer space with a comment on Andrews answer. :D
Cheers!
Dustin
You should be able do something like this from your view:
marker = GMarker.new(coords, :icon => home, :title => "home", :info_window => render(:partial => 'info_window') )
Where you have a partial in the same folder named _info_window.html.erb
For some reason, using (render :partial) as an argument supplied to the Gmarker caused only the partial to be rendered. When I changed it to render_to_string it worked.

Resources