最新版 |
編集中の文章 |
100行目: |
100行目: |
| == rails postgres == | | == rails postgres == |
| rails _6.0.3_ new tepnote -d postgresql | | rails _6.0.3_ new tepnote -d postgresql |
− |
| |
− | == 表示切り替え ==
| |
− | <div class="form-group">
| |
− | <label class="control-label" for="search"></label>
| |
− | <select class="form-control" name="search">
| |
− | <option value="">何を検索しますか?</option>
| |
− | <option value="house_notes">家備考</option>
| |
− | <option value="personal_notes">個人備考</option>
| |
− | </select>
| |
− | </div>
| |
− |
| |
− | <p id="house_notes" style="display: none;">
| |
− | <%= form_tag(search_user_path, :method => 'get') do %>
| |
− | <%= select_tag(:option, options_for_select([["user", "1"],["post","2"]]))%>
| |
− | <%= text_field_tag :search %>
| |
− | <%= submit_tag 'Search' %>
| |
− | <% end %>
| |
− | <p id="personal_notes" style="display: none;">
| |
− | <input type="text" name="writer" value="1" size="20" maxlength="20">
| |
− | </p>
| |
− |
| |
− | <script type="text/javascript">
| |
− | $(function(){
| |
− | $('select[name="search"]').change(function() {
| |
− | if ($('select[name="search"] option:selected').val() == 'house_notes')
| |
− | $('#house_notes').css('display','block');
| |
− | else
| |
− | $('#house_notes').css('display','none');
| |
− |
| |
− | if ($('select[name="search"] option:selected').val() == 'personal_notes')
| |
− | $('#personal_notes').css('display','block');
| |
− | else
| |
− | $('#personal_notes').css('display','none');
| |
− | });
| |
− | });
| |
− | </script>
| |