diff of 9719d78a72f88e472bb158d5ae48df47696e9886

9719d78a72f88e472bb158d5ae48df47696e9886
diff --git a/elm-frontti/src/Article.elm b/elm-frontti/src/Article.elm
index 31c6f4c..2e67007 100644
--- a/elm-frontti/src/Article.elm
+++ b/elm-frontti/src/Article.elm
@@ -35,6 +35,11 @@ decodeApply : Decode.Decoder a -> Decode.Decoder (a -> b) -> Decode.Decoder b
 decodeApply value partial =
     Decode.andThen (\p -> Decode.map p value) partial
 
+type ArticleSource
+    = Murja
+    | Rss
+      String -- <-link 
+      
 type alias PreviousArticle =
     { id: Int
     , title: String}
@@ -54,7 +59,7 @@ type alias Article =
     , hidden : Bool
     , unlisted : Bool
     , previously: List PreviousArticle
-    }
+    , source: ArticleSource}
 
 -- encoder
 
@@ -121,6 +126,7 @@ articleDecoder =
         |> decodeApply hiddenDecoder
         |> decodeApply unlistedDecoder
         |> decodeApply previouslyDecoder
+        |> decodeApply (Decode.succeed Murja)
 
 type alias Title =
     { title : String
diff --git a/elm-frontti/src/Article_view.elm b/elm-frontti/src/Article_view.elm
index 052d8dd..02f9865 100644
--- a/elm-frontti/src/Article_view.elm
+++ b/elm-frontti/src/Article_view.elm
@@ -16,9 +16,11 @@ formatDateTime formatString zone posixTime =
 
 articleView settings loginstate zone the_actual_post =
     let versions = Maybe.withDefault [] the_actual_post.versions
+        url = case the_actual_post.source of
+                  Article.Rss link -> link 
+                  Article.Murja -> ("/blog/post/" ++ String.fromInt the_actual_post.id)
     in
-        div [class "post"] [ let post_id = the_actual_post.id in 
-                             a [href ("/blog/post/" ++ String.fromInt post_id)] [ text the_actual_post.title ]
+        div [class "post"] [ a [ href url ] [ text the_actual_post.title ]
                            , div [class "meta"] (List.append [ User.user_avatar the_actual_post.creator
                                                              , p [] [text ("By " ++ the_actual_post.creator.nickname)]
                                                              , case the_actual_post.created_at of
@@ -31,9 +33,11 @@ articleView settings loginstate zone the_actual_post =
                              
                            , (let post_id = the_actual_post.id in
                               case loginstate of
-                                  LoggedIn _ -> a [ href ("/blog/post/edit/" ++ String.fromInt post_id)
-                                                  , attribute "data-testid" "edit-post-btn"
-                                                  , onClick (OpenPostEditor post_id)] [text "Edit this post"]
+                                  LoggedIn _ -> case the_actual_post.source of
+                                                    Article.Murja -> a [ href ("/blog/post/edit/" ++ String.fromInt post_id)
+                                                                       , attribute "data-testid" "edit-post-btn"
+                                                                       , onClick (OpenPostEditor post_id)] [text "Edit this post"]
+                                                    Article.Rss _ -> div [] []
                                   _ -> div [] [])
                                                     
                            , article [ class "content"
diff --git a/elm-frontti/src/FeedView.elm b/elm-frontti/src/FeedView.elm
index 53b6c5f..28b445d 100644
--- a/elm-frontti/src/FeedView.elm
+++ b/elm-frontti/src/FeedView.elm
@@ -1,7 +1,7 @@
 module FeedView exposing (..)
 
 import DateFormat as Df
-import Feeds exposing (NewFeed)
+import Feeds exposing (..)
 import Dict 
 import Time
 import Message exposing (..)
@@ -16,46 +16,37 @@ import Tab exposing (TabEntry, tabs)
 
 import Random
 
-feed_item time_format zone item =
+feed_item loginstate settings zone item =
+    let time_format = settings.time_format
+        article = itemToArticle item in 
     case item.feed_id of
         Just feed_id ->
-            li [] [ h1 [] [ a [ href item.link ] [ text item.title] ]
-                  , (if item.title == "" then 
-                         h4 [] [ a [ href item.link] [ text (formatDateTime time_format zone item.pubdate) ]]
-                     else
-                         h4 [] [ text (formatDateTime time_format zone item.pubdate)])
-                  , div [ class "feed-read"] [
-                         let is_read = item.is_read in
-                         button [ onClick <| ReadFeedItem feed_id item.id (not is_read) ] [ text "Mark as read"]]
-                  , div [ class "feed-author"] [ text <| "By " ++ item.author]
-                  , div [ class "feed-item"
-                        -- this is a bit moronic xss vuln, I should research how others have sanitized the html from rss/atom feeds 
-                        , dangerouslySetInnerHTML item.description] []]
+            li [] [ Article_view.articleView settings loginstate zone article ]
         Nothing ->
             li [] [ text "Unknown feed" ]
 
-correctlySortedFeedItemList settings zone items = 
+correctlySortedFeedItemList loginstate settings zone items = 
     (  items
     |> List.sortBy (Time.posixToMillis << .pubdate)
     |> List.reverse
-    |> List.map (feed_item settings.time_format zone))
+    |> List.map (feed_item loginstate settings zone))
 
 -- fs = feeds, elm sucks balls at shadowing
-perFeedView settings zone fs new_feed_state = 
+perFeedView loginstate settings zone fs new_feed_state = 
     ul [ class "feed-list" ]
         (List.map (\feed ->
                        li [ class "feed" ]
                        [ header [] [ text <| feed.name ++ " (" ++ (String.fromInt (List.length feed.items)) ++ ")" ]
                        , a [ href feed.url ] [ text feed.url ]
                        , ul [ class "feed-items" ]
-                           (correctlySortedFeedItemList settings zone <| List.map (\i -> { i | feed_id = Just feed.id}) feed.items)]) fs)
+                           (correctlySortedFeedItemList loginstate settings zone <| List.map (\i -> { i | feed_id = Just feed.id}) feed.items)]) fs)
             
-singleFeedView settings zone fs =
+singleFeedView loginstate settings zone fs =
     let final_feed = List.concatMap (\feed -> List.map (\item -> { item | feed_id = Just feed.id}) feed.items) fs in
     div []
         [ header [] [ text <| (String.fromInt (List.length final_feed)) ++ " unread articles"  ]
         , ul [ class "feed-items" ]
-            (correctlySortedFeedItemList settings zone final_feed)]
+            (correctlySortedFeedItemList loginstate settings zone final_feed)]
               
 
 readerState_str state =
@@ -64,7 +55,7 @@ readerState_str state =
         SingleFeed -> "SingleFeed"
         FeedManager -> "FeedManager"
                              
-feeds feedReaderState show_archived settings zone fs new_feed metadata =
+feeds feedReaderState loginstate show_archived settings zone fs new_feed metadata =
     let new_feed_state = Maybe.withDefault (NewFeed "" "") new_feed
     in
         div [ id "feeds" ] 
@@ -73,8 +64,8 @@ feeds feedReaderState show_archived settings zone fs new_feed metadata =
                                , onClick <| ShowArchivedFeedItems (not show_archived)] []
                        , text "Show read items"]
             , tabs "rss-feed-tab" (readerState_str feedReaderState) Nothing
-                  (Dict.fromList [ ("PerFeed", TabEntry "Group by feed" (perFeedView settings zone fs new_feed_state) Nothing ["*"])
-                                 , ("SingleFeed", TabEntry "Show all in a feed" (singleFeedView settings zone fs) Nothing ["*"])
+                  (Dict.fromList [ ("PerFeed", TabEntry "Group by feed" (perFeedView loginstate settings zone fs new_feed_state) Nothing ["*"])
+                                 , ("SingleFeed", TabEntry "Show all in a feed" (singleFeedView loginstate settings zone fs) Nothing ["*"])
                                  , ("FeedManager", TabEntry "Manage feeds" (feedmanager settings.time_format zone fs) Nothing ["*"])])
                   
             , h3 [] [ text "Add new feed?"]
diff --git a/elm-frontti/src/Feeds.elm b/elm-frontti/src/Feeds.elm
index 48574da..e22506d 100644
--- a/elm-frontti/src/Feeds.elm
+++ b/elm-frontti/src/Feeds.elm
@@ -39,6 +39,11 @@ type alias NewFeed =
 type alias FeedMetadata =
     { last_update_timestamps: List String}
 
+-- Article conversion
+itemToArticle item =
+    let creator = Creator "" item.author "" in 
+    Article.Article creator [] item.description Nothing item.title -1 Nothing (Just 1) (Just item.pubdate) False False [] (Article.Rss item.link)
+
 -- metadata decoder
 
 metadataDecoder = Decode.succeed FeedMetadata
diff --git a/elm-frontti/src/Main.elm b/elm-frontti/src/Main.elm
index 65952fc..95192bb 100644
--- a/elm-frontti/src/Main.elm
+++ b/elm-frontti/src/Main.elm
@@ -778,7 +778,7 @@ blog_tab settings model =
 rss_tab model settings =
     div []
     (case model.view_state of
-        Feeds feeds show_archived -> [ FeedView.feeds model.feedReaderState show_archived settings model.zone feeds model.new_feed model.feedMetadata]
+        Feeds feeds show_archived -> [ FeedView.feeds model.feedReaderState model.loginState show_archived settings model.zone feeds model.new_feed model.feedMetadata]
         _ -> [ div [] [ text "Unknown viewstate in rss_tab"] ])
 
 postmanager_tab model =
diff --git a/resources/css/murja.css b/resources/css/murja.css
index bb72373..9f4dea9 100644
--- a/resources/css/murja.css
+++ b/resources/css/murja.css
@@ -84,6 +84,7 @@ html, body {
 
 .post {
     width: 100%;
+    margin-bottom: 4em;
 }
 
 body, dialog {
@@ -361,7 +362,7 @@ header {
 
 #posteditor-preview-tab {
     flex: 3;
-} 
+}
 
 @media only screen and (max-device-width:480px)
 {