I am new to Jade and Scalate. I have the following route defined:
get("/") {
jade("index",
"pageTitle" -> "Welcome to Jade",
"welcomeMessage" -> "Hello my pretties")
}
And the template:
-# val pageTitle: String
-# val welcomeMessage: String
!!! 5
html(lang="en")
head
title= pageTitle
body
h1= welcomeMessage
The error I get on page render is:
The value for 'title' was not set
org.fusesource.scalate.NoValueSetException: The value for 'title' was not set
at org.fusesource.scalate.RenderContext$$anonfun$attribute$1.apply(RenderContext.scala:159)
Even if I remove the line title= pageTitle I still get the error. What is the error referring to and how do I fix it?
I didn't notice default.scaml in the layouts folder. It was defining, but not setting, title.
You could also do a clean build with SBT as follows.
sbt clean clean-files
Note: You need to exit SBT first.
I had a similar value-not-set error for a different reason but this command helped me resolve the problem.
Related
The question is simple and Im can't believe I cant found a solution (without context) for a situation as simple as this.
Im using react-intl.
I have an App.jsx with a child component Index.jsx with a SideBar.jsx with a CreateNewSomething.jsx.
In every components, the command
<FormattedMessage
id="new_object.fill_title"
defaultMessage='Please fill the "title" parameter'
/>
works perfectly thanks to <IntlProvider> provided by App.jsx
Unfortunally, I can't inject FormattedMessage as state value of a component.
Example:
<Input
s={6}
label={label_dash_title}
style={style_items_form}
onChange={this.onDashTitleChange}
onKeyPress={this.newDashHandleEnterKey}
error= { this.state.title_error }
/>
When the input field is not filled (is required) I want to print an error message.
Unfortunally I can't write:
const error_message = <FormattedMessage
id="new_dash.fill_title"
defaultMessage='Please fill the "title" parameter'
/>
this.setState({"title_error" : error_message});
because I get [object Object] and there is no property inside of it with my translated message.
Searching everywhere, I found I have to use this.props.intl.formatMessage({id: 'new_dash.fill_title'});
but this.props.intl is undefined.
I've tried, in App.jax, to include:
import {addLocaleData, IntlProvider, injectIntl, intlShape} from 'react-intl';
but it makes no difference.
I've tried to pass intl to every child component as props but intl is undefined in App.jsx too.
I don't know where is my mistake.
The module's Wiki explain the method but not how to use.
The solution is simple. You have to change the Export Syntax of your React Component and than this.props.intl will be magically available in the component:
export default injectIntl(MyComponent); //WORKS!!!
Unfortunally:
export default class injectIntl(MyComponent) extends React.Component //DOESN'T WORK
I'm trying to show a title of a news as a link
#using Glass.Mapper.Sc.Web.Mvc
#model MVC.com.Models.News
it works:#Model.Title<br/>
it dosen't work : #Html.Glass().RenderLink(x => x.Url,new {#class=""} ,true, Model.Title)
Anchor tag works fine but can not generate a link using RenderLink.
Meanwhile, is there any way I can eliminate #Html.Glass() helper from lines? I added Glass.Mapper.Sc.Web.Mvc to file Web.config but still have to wirte #Html.Glass() at the beginning of each command
You can eliminate #Html.Glass() this way:
#using Glass.Mapper.Sc.Web.Mvc
#RenderLink(Model, x => x.Link, new { #class = "btn" }, true,Model.Title)
i think you can do this which should eliminate #Html.Glass()
#inherits GlassView<News>
after that i think you should be able to do this.
#RenderLink(Model, x=>x.Url,new{#class=""},true)
in my sitecore instance i install SOLS ACCELERATORS Module,
when I verify my showconfig in /admin/showconfig.aspx
i found this error message
error on line 2383 at column 612: Extra happy at the end of the document
in app_config/include/Sitecore.SBOSAccelerators.config
I removed the following line
<pageextenders>
<pageextender type="Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender, Sitecore.SbosAccelerators" />
</ pageextenders>
the showconfig.aspx works well
I tried to analyze the code of InsertAnalyticsDataExtender, but I found nothing until now,
someone already has this kind of problem?
thank you
ok that's fixed,
the author of SOLS ACCELERATORS Module, verify if the context of the current Site is not Shell or Sheel_Module beffor adding a hidden field with this ID "SC_ANALYTICS_PAGE"
but what happen if the contentType of the page is an XML or a json for example
in this case i'm going to have an error,
to fixe this issue just create a new class in your solution, inherite from
Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender
add this methode to your class
public override void Insert()
{
// you can replace Context.Site.Name by Context.Page.Page.Response.ContextType=="Text/Xml"
if (Context.Site.Name == "admin")
return;
base.Insert();
}
after that go to Sitecore.SBOSAccelerators.Config and change your pageextender to use the new class
happy conding
If you pasted the part of the configuration directly from your config file, you have a type in the config. You cannot close any tag with whitespace at the beginning of the closing tags like this </ pageextenders>. Try without the space </pageextenders>:
<pageextenders>
<pageextender type="Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender, Sitecore.SbosAccelerators" />
</pageextenders>
I've generated testsuits via "cake bake testsuit" and used localhost/test.php for my app.
So, the is an error when I tried to run one of test (else tests are valid):
Fatal error: Class 'ErrorHandler' not found in Z:\home\prodvigator\www\cake\libs\object.php on line 201
This models and controllers are generated by scaffold and I don't think that an error is in this sources.
Using:
CakePHP 1.3
The latest SimpleTest
In my case, deleting all the files in the folder /app/tmp/cache/persistent solved the problem.
try checking the generated tests for an error that gets written at the top of the file.
sometimes i've been known to find something like this in both model and controller tests.
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /projectname/cake/console/templates/default/classes/test.ctp on line 22
In my case, the error was:
Fatal error: Uncaught Error: Class 'ErrorHandler' not found in C:\[path]\core\cake\libs\object.php on line 211
( ! ) Error: Class 'ErrorHandler' not found in C:\[path]\core\cake\libs\object.php on line 211
The error was happening to me when trying to visit http://localhost/user_accounts/index
I already had the view created at app\views\user_accounts\index.ctp with the following content:
<div>
Text from div
</div>
I had created the corresponding controller as well at app\controllers\user_accounts_controller.php:
<?php
class UserAccountsController extends AppController {
public function index() {
// Render the view in /views/user_accounts/index.ctp
$this->render();
}
}
?>
Since I was not associating a model to this controller, I was missing this: var $uses = array();. It would have saved me time if the error had been more explicit, something such as "You do not have a model associated to this controller".
The fix was:
<?php
class UserAccountsController extends AppController {
// Use this controller without a need for a corresponding Model file.
var $uses = array();
public function index() {
// Render the view in /views/user_accounts/index.ctp
$this->render();
}
}
?>
i want to put rel=lightbox to some links that mediabox support using javascript.
i try this and wonder why it's not working?
test: http://jsbin.com/opica
please help edit this: http://jsbin.com/opica/edit
<script type="text/javascript">
var x=xmlDoc.getElementsByTagName("a");
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
for(i=0;i<x.length;i++)
{
a=x[i].getAttribute('href');
if (a.match(regexku) != null)
{
x.item(i).setAttribute("rel","lightbox");
}
}
</script>
So if you open the Error Console (Tools -> Error Console in Firefox), you'll see two errors on your page:
Error: xmlDoc is not defined
Source File: http://jsbin.com/opica
Line: 35
Error: invalid regular expression flag v
Source File: http://jsbin.com/opica
Line: 21, Column: 38
Source Code:
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
The later is fixed by escaping the slash as Bart suggested (com\/video).
The former says there's no such thing as xmlDoc. You probably meant the page's document, in which case you should replace it with document.
Next the whole thing probably won't work because you should run the script after the page is finished loading. In jQuery it's $(document).ready(function() { /* do your work here */ }), google how to do it using the whatever framework you're using (mootools-yui?).
After that as you can see, the rel attribute is set on the links: http://jsbin.com/elaca/edit. The fact that the whatever library you're using still doesn't work means you're using it wrong. You didn't even link to the page you've downloaded the library from so that someone could look up the documentation for you...
Try escaping the / between com and video.