Note that there are some explanatory texts on larger screens.

plurals
  1. PORails Locked Screen effect Javascript
    primarykey
    data
    text
    <p>Recently got a new job as a Rails developer, having never previously used the language and it's quite a leap.</p> <p>I'm working on a locked screen effect for the website, where a link can be clicked which blanks the webpage and requires the user to enter their password again in order to remove the overlay. The overlay is a jQuery modal as follows:</p> <pre><code>$().ready( function() { $('.blackoutwindow').jqm({ modal: true, trigger: '.blackout', overlay: 100 }); if (boset) { $('.blackoutwindow').jqmShow(); } }); </code></pre> <p>When the link with id "blackout" is clicked the window appears. The JS variable <code>boset</code> is set in my view from a Rails session var which determines if the user has the screen blanked (so that the blanking persists on refresh, etc) <code>&lt;%= javascript_tag "var boset = #{session[:blanked]} "%&gt;</code></p> <p>Inside the modal div is my Rails password form:</p> <pre><code>&lt;%= form_tag passcheck_path, :id =&gt; "passcheck", :remote =&gt; true do -%&gt; &lt;%= hidden_field_tag :email, current_user.email %&gt; &lt;ul&gt; &lt;li&gt;&lt;%= password_field_tag 'password', nil, { :size =&gt; 30, :maxlength =&gt; 80, :class =&gt; :required } %&gt;&lt;/li&gt; &lt;li&gt;&lt;%= submit_tag 'Submit' %&gt;&lt;/li&gt; &lt;li&gt;&lt;span class="ajaxmessage"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;% end -%&gt; </code></pre> <p>Which (by means which I don't really understand) sends the password to an action in my sessions_controller.rb called passcheck, in a kind of AJAX style, which authenticates the password.</p> <p>Now that I've explained where I am currently, how do I now close the jQuery modal if the password is correct, update the span .ajaxmessage if the password isn't correct, and also, set the session variable when someone originally clicks on the "blank screen" link?</p> <p>Hope I was clear enough, any questions, fire away..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload