MyBB Community Forums

Full Version: Close dialog on custom theme?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on a custom theme which uses bootstrap, and when I bootstrapped the reputation dialog the "submit" button no longer closes.  I was wondering if there was a genius who might have an idea on how to get this to work?  Before when I posted support threads in the themes section no one ever responded.  So I am being mean and posting it here.

I tried adding the following code to the submit button, but then it closes without submitting the reputation.
data-dismiss="modal"



This is what the dialog code looks like.  As you can see, I am basically just bootstrapping the default theme.  There are no major changes other than switching it over to to use bootstrap components.  

<div class="modal fade" role="dialog">
  <div class="modal-dialog modal_{$pid}">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" rel="closeModal" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title"><strong>{$vote_title}</strong></h4>
        <br />
        {$post_rep_info}
      </div>
      <div class="modal-body">
        <table  class="table" cellpadding="0" cellspacing="0" border="0">
          <tr>
              <td class="trow1" style="padding: 20px">
                <form action="reputation.php" method="post" class="reputation_{$user['uid']}_{$mybb->input['pid']}" onsubmit="javascript: return MyBB.submitReputation({$user['uid']}, {$mybb->input['pid']});">
                      <input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
                      <input type="hidden" name="action" value="do_add" />
                      <input type="hidden" name="uid" value="{$user['uid']}" />
                      <input type="hidden" name="pid" value="{$mybb->input['pid']}" />
                      <input type="hidden" name="rid" value="{$rid}" />
                      <input type="hidden" name="nomodal" value="1" />
                      <select name="reputation" id="reputation">
                          {$positive_power}
                          {$neutral_power}
                          {$negative_power}
                      </select>
                      <br /><br />
                      <span class="smalltext">{$lang->user_comments}</span>
                      <br />
                      <input type="text" class="textbox" name="comments" size="35" maxlength="250" value="{$comments}" style="width: 95%" />
                      <br /><br />
                      <div style="text-align: center;">
                          <input type="submit" class="button" value="{$vote_button}"/>
                          {$delete_button}
                      </div>
                  </form>
              </td>
          </tr>
		</table>
      </div>
    </div>
  </div>
</div>
When you fire a modal dialog window a close button is generated automatically. For a close button you can add

<a href="#" rel="modal:close">My text (or icon) here</a>

Close function relies on rel attribute (with value modal:close).
(2014-09-15, 05:37 PM)Johnny S Wrote: [ -> ]When you fire a modal dialog window a close button is generated automatically. For a close button you can add


<a href="#" rel="modal:close">My text (or icon) here</a>

Close function relies on rel attribute (with value modal:close).

Hmmm...  I am not really trying to add a close button though.  The X button on the top right works fine for that.  I just want to close the dialog when they actually submit the reputation so that they are aware it went through.  
I solved this by adding and ID to the dialog and changing the onsubmit javascript to:

onsubmit="javascript: $('#reputationModal').modal('hide'); return MyBB.submitReputation({$user['uid']}, {$mybb->input['pid']});"