javascript - Use Ruby Sinatra erb template to access jQuery Mobile (jqm) multipage html -


i have standard jquery-mobile multipage html file need access sinatra application erb templates. don't see how access bookmark or anchor within file.

my code simple:

get '/login'   erb :'admin.html#login_page' end 

but, is:

no such file or directory @ rb_sysopen - .../views/admin.html#login_page.erb: 

the file trying access

admin.html.erb

with bookmark of login_page.

the portion of html template trying access follows, though other pages included.

<div data-theme="b" data-role="page" id="login_page">   <%= partial :'main-header.html', locals: {page: 'management console login'} %>   <div class="ui-content">     <a href="#login" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">admin       login</a>     <div data-role="popup" data-history="false" id="login" class="ui-content" style="min-width:250px;">       <form action='/login_process' method='post' data-ajax='false'>         <div data-role="controlgroup">           <h3>administrative login</h3>           <label for="logon" class="ui-hidden-accessible">logon:</label>           <input type="text" name="user" id="logon" placeholder="logon">           <label for="password" class="ui-hidden-accessible">password:</label>           <input type="password" name="password" id="password" placeholder="password">           <input type="submit" id="loginbutton" data-transition="flip" value="login">         </div>       </form>     </div>   </div>   <%= partial :'frontend/footer.html' %>   <script type='application/javascript' src='assets/login_modal.js'></script> </div> 

i'd render need ruby translator. idea how make work or of better way it? thanks...

got working twist, still had problems other code not using it. converted anchor local variable , referenced html javascript go anchor.

in sinatra:

erb :'admin.html', :locals => {:anchor => "#login_page"} 

in page:

let body = $("body"); let anchor = <%= "\'#{anchor}\'" %>; body.on("pagecontainerbeforeshow", function (event, ui) {     body.pagecontainer("change", anchor); }); 

this worked. issue had had make dynamic changes on 1 page, based on beforeshow, not work.

but, did solve question.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -