Francisco Calix

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

show.html.erb 
 <div class="calendar_custom">
                                        
                                                <%= render partial: 'calendar',locals: {date: @day} %>
                                            </div>


show.js.erb
$("#calendar_custom").html("<%= escape_javascript render(partial: "calendar") %>");


_calendar.htmlerb
<div class="calendar_title">
        <span class="calendar_month"><%= "#{@date.strftime("%B")} #{@date.year}" %></span>
                                                    
        <%= link_to  room_path(@room,date: @date - 1.month), :class => "calendar_prev calendar_corner", :id =>"back", remote: true do %>
        <i class="lotus-icon-left-arrow"></i>
        <% end %>
                                            
        <a href="#" class="calendar_next calendar_corner"><i class="lotus-icon-right-arrow"></i></a>
</div>
                                            
            <%= calendar @date do |date| %>
            <%= date.day %>
            <% end %>
                                            


rooms_controller

  def show
    @room = Room.find(params[:id])
    @date = params[:date] ? Date.parse(params[:date]) : Date.today
    respond_to do |format|
      format.html
      format.js { render :partial => "calendar"}
  end
  end
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.